diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-01 10:44:35 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:31:38 -0700 |
| commit | eb4c4fbdc3951c220a76ec01abc33a7654d89e53 (patch) | |
| tree | 513ca3fe7b5ad9e94ab8660a773c9f53f72297f3 /spec | |
| parent | 8723b1c2102a181d23c9fe4ede7d58294f7c18ba (diff) | |
| download | puppet-eb4c4fbdc3951c220a76ec01abc33a7654d89e53.tar.gz puppet-eb4c4fbdc3951c220a76ec01abc33a7654d89e53.tar.xz puppet-eb4c4fbdc3951c220a76ec01abc33a7654d89e53.zip | |
(#6749) Start porting existing strings to the options API.
This provides a solid test of the new code, by migrating the existing strings
to match. This also gives us a chance to determine any weak points in the
code as written.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x[-rw-r--r--] | spec/unit/application/configurer_spec.rb | 0 | ||||
| -rwxr-xr-x | spec/unit/string/action_builder_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/string/indirector_spec.rb | 4 | ||||
| -rw-r--r-- | spec/unit/string/option_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/string_spec.rb | 8 |
5 files changed, 9 insertions, 9 deletions
diff --git a/spec/unit/application/configurer_spec.rb b/spec/unit/application/configurer_spec.rb index 621039bcc..621039bcc 100644..100755 --- a/spec/unit/application/configurer_spec.rb +++ b/spec/unit/application/configurer_spec.rb diff --git a/spec/unit/string/action_builder_spec.rb b/spec/unit/string/action_builder_spec.rb index 0229fe44d..fde010d51 100755 --- a/spec/unit/string/action_builder_spec.rb +++ b/spec/unit/string/action_builder_spec.rb @@ -6,7 +6,7 @@ require 'puppet/string/action_builder' describe Puppet::String::ActionBuilder do describe "::build" do it "should build an action" do - action = Puppet::String::ActionBuilder.build(nil,:foo) do + action = Puppet::String::ActionBuilder.build(nil, :foo) do end action.should be_a(Puppet::String::Action) action.name.should == :foo @@ -24,7 +24,7 @@ describe Puppet::String::ActionBuilder do end it "should require a block" do - lambda { Puppet::String::ActionBuilder.build(nil,:foo) }. + lambda { Puppet::String::ActionBuilder.build(nil, :foo) }. should raise_error("Action :foo must specify a block") end diff --git a/spec/unit/string/indirector_spec.rb b/spec/unit/string/indirector_spec.rb index 89306c416..da5f569dc 100755 --- a/spec/unit/string/indirector_spec.rb +++ b/spec/unit/string/indirector_spec.rb @@ -33,8 +33,8 @@ describe Puppet::String::Indirector do Puppet::String::Indirector.should be_action(method) end - it "should just call the indirection method when the '#{method}' action is invoked" do - @instance.indirection.expects(method).with(:test, "myargs") + it "should call the indirection method when the '#{method}' action is invoked" do + @instance.indirection.expects(method).with(:test, "myargs", {}) @instance.send(method, :test, "myargs") end end diff --git a/spec/unit/string/option_spec.rb b/spec/unit/string/option_spec.rb index fc7b8329b..f4f62ec37 100644 --- a/spec/unit/string/option_spec.rb +++ b/spec/unit/string/option_spec.rb @@ -5,7 +5,7 @@ describe Puppet::String::Option do describe "#optparse_to_name" do ["", "=BAR", " BAR", "=bar", " bar"].each do |postfix| - { "--foo" => :foo, "-f" => :f,}.each do |base, expect| + { "--foo" => :foo, "-f" => :f }.each do |base, expect| input = base + postfix it "should map #{input.inspect} to #{expect.inspect}" do option = Puppet::String::Option.new(string, input) diff --git a/spec/unit/string_spec.rb b/spec/unit/string_spec.rb index 7f7489e2e..ddf855475 100755 --- a/spec/unit/string_spec.rb +++ b/spec/unit/string_spec.rb @@ -41,7 +41,7 @@ describe Puppet::String do end it "should instance-eval any provided block" do - face = Puppet::String.new(:string_test_block,'0.0.1') do + face = Puppet::String.new(:string_test_block, '0.0.1') do action(:something) do invoke { "foo" } end @@ -52,15 +52,15 @@ describe Puppet::String do end it "should have a name" do - Puppet::String.new(:me,'0.0.1').name.should == :me + Puppet::String.new(:me, '0.0.1').name.should == :me end it "should stringify with its own name" do - Puppet::String.new(:me,'0.0.1').to_s.should =~ /\bme\b/ + Puppet::String.new(:me, '0.0.1').to_s.should =~ /\bme\b/ end it "should allow overriding of the default format" do - face = Puppet::String.new(:me,'0.0.1') + face = Puppet::String.new(:me, '0.0.1') face.set_default_format :foo face.default_format.should == :foo end |
