summaryrefslogtreecommitdiffstats
path: root/spec/unit/application_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* maint: Fix case sensitive requireMatt Robinson2011-08-091-1/+1
| | | | | | | | Mac's filesystems aren't case sensitive, so developing this change didn't catch the issue with requiring filenames that had been uppercased. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* maint: Fix inspect helpMatt Robinson2011-08-091-0/+4
| | | | | | | | | | | | | | | | | | Running `puppet help inspect` did not result in help: Unable to find application 'inspect'. err: exit err: Try 'puppet help help help' for usage It turned out that the only reason applications were getting required so that their help could be found was the LegacyName conversion table in lib/puppet/util/command_line.rb:7. Inspect never had a legacy name, so the help system couldn't find it since it never got required. Now instead of checking for the class constant to see if the application has been loaded, we try to require the application and exit if it's not found. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* (#7507) Add ability to filter Ruby 1.9 spec failuresMatt Robinson2011-05-171-2/+2
| | | | | | | | | | | | | | | By running: rspec spec --tag ~@fails_on_ruby_1.9.2 We can now just run the specs that pass under Ruby 1.9. Obviously in the long term we want to have all the specs passing, but until then we need notification when we regress. From now on new code will be required to pass under Ruby 1.9, and Jenkins will give us email notification if it doesn't or if we break something that was already working. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* maint: use the exit_with helper everywhere...Daniel Pittman2011-04-221-13/+7
| | | | | | | Now we have the exit_with matcher, we should use it everywhere that we previously stubbed, expected, or caught the exit status in an ad-hoc way. Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
* maint: stop stubbing log level setting.Daniel Pittman2011-04-201-3/+1
| | | | | | | | | | | | | | | The underlying problem turned up when another test (as a side effect) changed the logging level to be more verbose, and a very distant test broke. This revealed that we didn't preserve that global state around tests. Fixing that further revealed that we stubbed setting that log level all over the place, as a point fix for the same problem, and to assert the operation of various tools. So, additionally, we strip out all that stubbing, and assert on the desired effect rather than the mechanism for achieving it. Reviewed-By: Max Martin <max@puppetlabs.com>
* maint: clean up the spec test headers in bulk.Daniel Pittman2011-04-131-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.
* (#6962) Move option handling into #parse_options, not #preinit.Daniel Pittman2011-04-121-10/+0
| | | | | | | | | | | | Logically, the extra work around option parsing for faces belongs in the application parse_options method, not hidden in the step before. This commit moves that to the right place and fixes the fallout from that strange early design decision. Along the way we unify error reporting for invalid options so that all the code paths result in the same externally detected failures. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* (#2150) Add routes file for indirectorNick Lewis2011-04-121-0/+50
| | | | | | | | | | | | | | | | | | | Puppet[:route_file] is a YAML file specifying the termini to use for various indirections, in the format: agent: catalog: terminus: rest cache: yaml master: catalog: terminus: compiler cache: active_record This file is optional, and will override application defaults set in "setup", as well as terminus settings, ie. facts_terminus. Paired-With: Jesse Wolfe
* maint: just require 'spec_helper', thanks rspec2Daniel Pittman2011-04-081-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>
* (#6582) stub puts to prevent screen output when testing help.Daniel Pittman2011-03-031-0/+1
| | | | | | | | We only really want to verify that the code exits, but the current implementation emits text directly; this results in messing up the tests, which we can avoid with this tiny shim. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* Merge branch 'maint/2.6.next/help' into nextJesse Wolfe2011-02-031-3/+44
|\
| * Maint: remove rdoc/usage dependencyJesse Wolfe2011-02-031-3/+2
| |
| * (#5823) run mode can now be set dynamically...Daniel Pittman2011-02-031-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | Third party scripts, and complex command line tools, depend on being able to configure the run_mode value at runtime, not just when they fire up. For better or worse we used to allow this sort of thing to work, but stopped, and we have no sane, safe and consensual alternative, so we broke a bunch of client code. This enables the feature again, but does not add any safety catch; you can now happily slice off your own feet with this, if you really want to.
* | Merge branch '2.6.x' into nextMatt Robinson2011-02-021-0/+19
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (46 commits) Augmentation of tests for prior commit Fix to fix for #5755 -- backref serialization issues in zaml Fixed #5564 - Added some more fqdn_rand documentation Fixed #4968 - Updated list of options turned on by --test in documentation (#5061) - allow special hostclass/define variables to be evaluated as defaults. (#6107) Fix an error when auditing a file with empty content Remove already initialized constant warning from file_spec.rb tests (#5566) Treat source only File checksums as syntax errors when used with content Rename variable used in File type validation to be more clear Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. Remove order dependency when specifying source and checksum on File type Bug #5755 -- ZAML generates extra newline in some hash backreferences. bug #5681 -- code fix to handle AIX mount output Bug #5681 -- parse AIX mount command output. Spec for #5681 to allow parsing of AIX mount output in mount provider Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes Bug #6091 -- test leading double-slash in filenames are allowed. Fixed #6071 - Fixed typo and improved exec path error message Fixed #6061 - Allowed -1 as password min/max age Bug #6061 -- verify that negative {min,max}_password_age are accepted. ... Manually Resolved Conflicts: lib/puppet/util/zaml.rb spec/unit/util/zaml_spec.rb
| * (#5913) Fix Puppet::Application.find constant lookup behaviorMitchell Hashimoto2011-01-161-0/+19
| | | | | | | | | | Puppet::Application.find now only looks in the Puppet::Application namespace for the given constant.
* | Merge branch '2.6.x' into nextNick Lewis2011-01-061-5/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Rakefile lib/puppet/resource/type_collection.rb lib/puppet/simple_graph.rb lib/puppet/transaction.rb lib/puppet/transaction/report.rb lib/puppet/util/metric.rb spec/integration/indirector/report/rest_spec.rb spec/spec_specs/runnable_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector_spec.rb spec/unit/transaction/change_spec.rb
| * (#5771) Upgrade rspec to version 2Matt Robinson2011-01-041-5/+2
| | | | | | | | | | | | | | | | | | The biggest change is that we no longer need to monkey patch rspec to get confine behavior. Describe blocks can now be conditional like confine used to be. "describe" blocks with "shared => true" are now "shared_examples_for". Paired-With: Nick Lewis
* | maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson2010-12-061-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
* Fixes #4822 -- Puppet doc -o option brokenPaul Berry2010-09-221-25/+16
| | | | | | | | | | The global "-o" option ("--onetime") was overriding the application-specific option "-o" because global options were being sent to the OptionParser after application-specific options. Modified the order in which options are sent to the OptionParser to have the correct behavior. Also merged together the two methods that were applying options so that the order is more explicit.
* [#4333] old optparse doesn't support default_argv=Jesse Wolfe2010-07-251-12/+2
| | | | | optparse hasn't always had the concept of default_argv. Fortunately, we don't really need it.
* Code smell: Two space indentationMarkus Roberts2010-07-091-377/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* [#4090] Git rid of the idea that run_mode is a configurable option with defaultsMatt Robinson2010-07-011-1/+13
| | | | | Along the way this fixes an issue with 2.6 alpha that sections of the puppet config file were getting ignored.
* [#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts2010-06-281-0/+519
| | | | Part 2 re-did the change on the spec files, which it shouldn't have.
* [#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts2010-06-281-519/+0
| | | | | | | | | Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
* [#3994] rename the specs to have _spec.rb at the endMarkus Roberts2010-06-231-0/+519
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700