summaryrefslogtreecommitdiff
path: root/spec/unit/parser/functions/include_spec.rb
AgeCommit message (Collapse)AuthorFilesLines
2014-06-11(PUP-121) Ensure classes are absolute when transforming to ResourceHenrik Lindberg1-1/+4
When the 3x to 4x calls take place, resource references in the form of a PCatalogEntryType are transformed to Puppet::Resource. Depending on where these (reference) Puppet::Resource instances are used they need to either be absolute, or not (yes, 3x is inconsistent). Since future parser in 3.7 (and later 4.0) will not support dynamic name scoping, the PCatalogEntryType's should in general be absolute. This commit changes the transformation to make the created Puppet::Resource (references) absolute (when it is possible). This also adds more tests
2014-05-26(PUP-121) Make examples for relative/absolute sharedHenrik Lindberg1-34/+4
This makes the examples that test include, require, contain share the same tests. This also adds one missing error condition.
2014-05-16(PUP-121) Add more tests, doc, and correct behaviorHenrik Lindberg1-1/+42
This generalizes the "make names absolute" to a transformation of given arguments to class names strings suitable for lookup, and also applying the transformation to Class and Resource reference types.
2014-01-14(PUP-1118) Fetch the environment's manifest & modulepath at initAndrew Parker1-1/+0
After trying to get the manifest and modulepath during the initialization for an environment, it turned out that a lot of other things depended on a very specific load order. Some of those needed to change around, others needed to delay executing until later, after everything had been loaded and initialized (creation of the root environment was one of these). The reset of the Parser::Functions also moved so that it doesn't happen until settings have been initialized.
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-09-10(#15756) Call functions correctly in testsAndrew Parker1-3/+3
These tests relied on being able to call functions in the incorrect fashion of not passing an array as the argument. They now call the function under test correctly.
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-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-06Merge pull request #535 from ↵Chris Price1-0/+12
eshamow/tickets/master/7801_include_should_accept_arrays (#7801) Modify include function to accept arrays
2012-04-05(#7801) Modify include function to accept arraysEric Shamow1-0/+12
When an array of classes is passed to the :include function, it currently attempts to wrap the array in another array, and then pass the entire array through as a single argument, causing an error. This commit calls flatten against the array before sending it through, following the pattern of :realize, and enabling arrays to be passed as well as comma-separated or individual class values.
2012-03-30Port old `test/language` tests into rspec...Daniel Pittman1-0/+5
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>
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman1-2/+1
We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment.
2011-04-08maint: just require 'spec_helper', thanks rspec2Daniel Pittman1-1/+1
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
2011-03-16(#6722) load all functions before testing...Daniel Pittman1-0/+3
We historically had a state-dependency across tests in the parser function support area; the first test caused the function to be loaded, and other tests would then fail as a consequence of that. We now autoload all functions at the top of each test suite, allowing us to correctly and sensibly test on them as we should. This theoretically prevents us from testing the autoloader implicitly in these tests, but that should be tested independently. Paired-With: Nick Lewis <nick@puppetlabs.com>
2010-12-06maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson1-1/+1
Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
2010-08-03[#4242] Fixed (removed) a broken unit testNick Lewis1-22/+0
This test ran into a mocha bug, and was stubbing too much anyway. It's being moved to an acceptance test.
2010-07-25Temporary tweak to tests for #4242Markus Roberts1-0/+5
The tests introduced with the fix for #4242 have isolation issues apparently due to the creation of a stage resource which is global and persistent. This patch stubs the creation, marks the one test which is thus invalidated pending, and adds comments noting the problem.
2010-07-25[#4242] Fixed recursion due to parents including their childrenNick Lewis1-0/+50
Resources mark themselves as evaluated to prevent being evaluated again. Unfortunately, they were not marking themselves until after they had finished being completely evaluated. Thus, there was nothing actually stopping recursive evaluations. This patch just makes resources mark themselves as evaluated when they start evaluating, and adds tests. The original setting of evaluated was done in an ensure block, so this doesn't change the behavior of a resource which fails to evaluate. The only places evaluated? is checked aren't affected by this change, as they wouldn't want to evaluate it when it's already being evaluated anyway.