summaryrefslogtreecommitdiff
path: root/spec/unit/parser/functions/file_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-07-11(maint) Remove pointless testAndrew Parker1-4/+0
Testing that the function exists isn't really needed since the later tests that actually use the function will find that fairly quickly.
2014-07-10(PUP-2626) Allow module paths in file()Daniel Thornton1-1/+48
This modifies the file() function to accept module paths (like the template() function) as well as fully qualified paths. This makes it possible for modules that use the file() function to be more portable, instead of being tied to a specific puppet server configuration. Example with directory structure: /etc/puppet/modules/example ├── files │ └──file.ext ├── manifests │ └──init.pp └── templates └──template.erb When the module path for files can be used instead of the absolute path: file('example/file.ext') returns the same as file('/etc/puppet/modules/example/files/file.ext'). This is supposed to be like how template does module paths, where: template('example/template.erb') returns the same as template('/etc/puppet/modules/example/templates/template.erb')
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune1-1/+1
Without this patch Ruby 1.9 is still complaining loudly about trying to parse the spec files. The previous attempt to clean up this problem in edc3ddf works for Ruby 1.8 but not 1.9. I'd prefer to remove the shebang lines entirely, but doing so will cause encoding errors in Ruby 1.9. This patch strives for a happy middle ground of convincing Ruby it is actually working with Ruby while not confusing it to think it should exec() to rspec. This patch is the result of the following command run against the source tree: find spec -type f -print0 | \ xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
2012-07-24wipPatrick Carlisle1-2/+4
2012-07-15Drop the hash prefix when passing compiler to scope.Daniel Pittman1-1/+1
Now that the compiler is always required by the scope we can save a few keystrokes by making the non-optional argument a regular value, not a name prefixed option. (...even if I love Objective-C as much as the next developer, having the same text in every call just to name the argument doesn't make much sense in such an internal context.) Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-07-15A scope always has a compiler.Daniel Pittman1-1/+3
The scope object contained some internal code to substitute an external environment when the compiler was not supplied. This was used only in testing, not in any production capacity. In light of that, we can eliminate the dynamic decision making inside the scope and simply demand that a compiler instance (or a fake equivalent) is always supplied. This reduces the complexity of the code and makes clearer the object relationships involved. (The small cost is a lot of testing that depended on this had to change to use a real compiler. Most of the change derives from that.) Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune1-1/+1
Without this patch some spec files are using `ruby -S rspec` and others are using `rspec`. We should standardize on a single form of the interpreter used for spec files. `ruby -S rspec` is the best choice because it correctly informs editors such as Vim with Syntastic that the file is a Ruby file rather than an Rspec file.
2012-04-18Make a path absolute on Windows as well as Unix.Daniel Pittman1-1/+1
When this test was changed the path became relative on Windows, because it doesn't have a drive letter. This fixes that with `make_absolute`. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
2012-03-30Port old `test/language` tests into rspec...Daniel Pittman1-0/+51
In Ruby 1.9 the Test::Unit library was replaced by MiniTest. This changes some "esoteric" parts of the code, sadly including the parts of the library we depend on to confine certain tests to only some systems. Instead of investing heavily in rebuilding that facility over the new MiniTest library it makes sense to just check for and either destroy or port the old tests to the new rspec harness. This is our desired future - that only one test framework exist - and we might as well take full advantage of this opportunity to clean up our legacy code. It also drops tests that duplicate testing already present in the spec suite. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>