summaryrefslogtreecommitdiff
path: root/spec/unit/parameter
AgeCommit message (Collapse)AuthorFilesLines
2013-09-26(#22699) set value_collection for boolean paramsDustin J. Mitchell1-12/+22
2013-07-11(maint) Fix rspec warningsPatrick Carlisle1-7/+7
Running specs with rspec 2.13 caused a lot of warnings. Many of them actually exposed preexisting bugs, the most common being a syntax error when expecting an Exception. These are worth fixing even if we don't bump to rspec 2.13.
2013-04-30Add DRY support for boolean parametersDustin J. Mitchell1-0/+25
Boolean parameters are common and used several places in the codebase, as well as in user code. Without this change, each parameter requires a description of true and false values, and code to recognize those values. That is implemented slightly differently from place to place, leading to inconsistent behavior for users. And anyway, it's all WET. Instead, this concentrates the implementation in one place. This is easier for users (a consistent set of true/false values) and developers (less boilerplate and easy resulting values -- Ruby's true and false, not :true or "true" or anythign like that).
2012-09-26(Maint) Remove rspec from shebang lineJeff McCune4-4/+4
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-08-06(#11870) Add package options parameterJosh Cooper1-0/+44
This commit adds a new package options parameter type that accepts an array of strings or hashes. For example, [ 'arg1', { 'key2' => 'val2', 'key2' => 'val3' }, 'arg4' ] The parameter preserves the order of array elements, as it may be significant for a provider, e.g. '--source', 'URL'. Order of hash key-value pairs is based on the natural sort order of the keys. Any argument containing spaces will automatically be quoted, so that you don't have to check that in each manifest. The package options parameter is not currently used, but will be in a future commit to enable install and uninstall options to be passed to the package provider. Oddly, if any puppet parameter is specifed as an array with one element, puppet's parser-based resource will automatically de-arrify it (see commit 46252b5b). As a result, if an array is a valid value, then the validate & munge methods cannot reject an element that isn't an array. Therefore, the package options munge method arrayifies values, which has the side-efect that it will accept the 2.7.x style way of declaring install_options for MSI packages. Moreso, it means that the old way cannot be deprecated without changing core puppet behavior.
2012-07-02(maint) Standardize on /usr/bin/env ruby -S rspecJeff McCune3-3/+3
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.
2011-04-13maint: clean up the spec test headers in bulk.Daniel Pittman3-5/+3
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 Pittman3-3/+3
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-23Merge branch '2.6.next' into nextMax Martin1-0/+24
* 2.6.next: Fixed #6562 - Minor kick documentation fix (#6658) Propagate ENC connection errors to the agent (#4884) Remove typo from spec test (#4884) Modify tests to pass on non-OS X systems (#4884) Revise new exec tests, add a few more (#4884) Add an shell provider for execs (#4884) Fix Test::Unit exec tests (#4884) Break the exec type out to have a posix provider (#4884) Add consistent path validation and behavior (#4884) Add expand_path to requiring the spec_helper (#4884) Autorequire shared behaviors and method to silence warnings (#4884) Fix whitespace (#4884) Get rid of open3 require since it wasn't being used (#5814) Improved cron type specs (#5814) cron_spec shouldn't depend on cron provider Manually Resolved Conflicts: lib/puppet/util/command_line/puppetrun spec/spec_helper.rb spec/unit/type/exec_spec.rb spec/unit/type_spec.rb test/ral/type/exec.rb
2011-03-15(#4884) Add consistent path validation and behaviorDaniel Pittman1-0/+24
Many path parameters were implementing their own inconsistent validation and behavior. Now those parameters can have a parent class that makes things a lot more consistent. Reviewed-by: Matt Robinson and Max Martin
2010-12-06maint: Use expand_path when requiring spec_helper or puppettestMatt Robinson2-2/+2
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-12Further RST to Markdown fixes for types, values, testsJames Turnbull1-2/+2
2010-07-09Code smell: Two space indentationMarkus Roberts2-197/+197
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
2010-06-28[#3994-part 3] rename spec tests from *_spec_spec to *_spec.rbMarkus Roberts2-0/+0
Part 2 re-did the change on the spec files, which it shouldn't have.
2010-06-28[#3994-part 2] rename integration tests to *_spec.rbMarkus Roberts2-0/+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
2010-06-23[#3994] rename the specs to have _spec.rb at the endMarkus Roberts2-0/+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
2010-02-17Moving Parameter utility classes into separate filesLuke Kanies2-0/+255
Signed-off-by: Luke Kanies <luke@madstop.com>