diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-01 12:47:32 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:32:04 -0700 |
commit | 37c97cdca07fd8c446e924547239c8f09eda8810 (patch) | |
tree | 0838bc7226343530a5e635ca54872ff819a85d53 | |
parent | d328af73e688df136ee6fe10340adf7ba72b951e (diff) | |
download | puppet-37c97cdca07fd8c446e924547239c8f09eda8810.tar.gz puppet-37c97cdca07fd8c446e924547239c8f09eda8810.tar.xz puppet-37c97cdca07fd8c446e924547239c8f09eda8810.zip |
(#6749) clean up various testing bits...
This cleans up a whole bunch of bits of the testing code around the place;
nothing revolutionary, just nicer and more robust code.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
-rwxr-xr-x | spec/unit/application/string_base_spec.rb | 30 | ||||
-rwxr-xr-x | spec/unit/string/indirector_spec.rb | 8 |
2 files changed, 23 insertions, 15 deletions
diff --git a/spec/unit/application/string_base_spec.rb b/spec/unit/application/string_base_spec.rb index 37f6fddcb..20185b526 100755 --- a/spec/unit/application/string_base_spec.rb +++ b/spec/unit/application/string_base_spec.rb @@ -38,24 +38,32 @@ describe Puppet::Application::StringBase do app.command_line.stubs(:args).returns %w{} end - it "should set the string based on the type" - it "should set the format based on the string default" - describe "parsing the command line" do before :all do Puppet::String[:basetest, '0.0.1'].action :foo do option "--foo" - invoke do |options| - options - end + invoke { |options| options } end end - it "should find the action" do - app.command_line.stubs(:args).returns %w{foo} - app.preinit - app.action.should be - app.action.name.should == :foo + context "with just an action" do + before :all do + app.command_line.stubs(:args).returns %w{foo} + app.preinit + end + + it "should set the string based on the type" do + app.string.name.should == :basetest + end + + it "should set the format based on the string default" do + app.format.should == :pson + end + + it "should find the action" do + app.action.should be + app.action.name.should == :foo + end end it "should fail if no action is given" do diff --git a/spec/unit/string/indirector_spec.rb b/spec/unit/string/indirector_spec.rb index 29e8e7086..cb85eaa05 100755 --- a/spec/unit/string/indirector_spec.rb +++ b/spec/unit/string/indirector_spec.rb @@ -41,13 +41,13 @@ describe Puppet::String::Indirector do end it "should be able to override its indirection name" do - @instance.set_indirection_name :foo - @instance.indirection_name.should == :foo + subject.set_indirection_name :foo + subject.indirection_name.should == :foo end it "should be able to set its terminus class" do - @instance.indirection.expects(:terminus_class=).with(:myterm) - @instance.set_terminus(:myterm) + subject.indirection.expects(:terminus_class=).with(:myterm) + subject.set_terminus(:myterm) end it "should define a class-level 'info' action" do |