From 0fa10a6a6315959e5cae1e61aef13610ec126e13 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 28 Jun 2010 16:00:16 -0700 Subject: Cleaning up various warnings in specs There were a bunch of "warning: parenthesize argument(s) for future version" messages; now there aren't. --- spec/unit/indirector/resource/ral_spec.rb | 2 +- spec/unit/network/http/compression_spec.rb | 12 ++++++------ spec/unit/parser/ast/in_operator_spec.rb | 4 ++-- spec/unit/type_spec.rb | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/unit/indirector/resource/ral_spec.rb b/spec/unit/indirector/resource/ral_spec.rb index f74bf3d60..c3dc8d8cf 100644 --- a/spec/unit/indirector/resource/ral_spec.rb +++ b/spec/unit/indirector/resource/ral_spec.rb @@ -25,7 +25,7 @@ describe "Puppet::Resource::Ral" do require 'puppet/type/user' Puppet::Type::User.expects(:instances).returns([ wrong_instance, wrong_instance ]) result = Puppet::Resource::Ral.new.find(@request) - result.should be_is_a Puppet::Resource + result.should be_is_a(Puppet::Resource) result.title.should == "root" end end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb index 9b9a2a516..63fd9e715 100644 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -32,7 +32,7 @@ describe "http compression" do it "should yield an identity uncompressor" do response = stub 'response' @uncompressor.uncompress(response) { |u| - u.should be_instance_of Puppet::Network::HTTP::Compression::IdentityAdapter + u.should be_instance_of(Puppet::Network::HTTP::Compression::IdentityAdapter) } end end @@ -120,14 +120,14 @@ describe "http compression" do it "should yield an identity uncompressor with no content-encoding" do @uncompressor.uncompress(@response) { |u| - u.should be_instance_of Puppet::Network::HTTP::Compression::IdentityAdapter + u.should be_instance_of(Puppet::Network::HTTP::Compression::IdentityAdapter) } end it "should yield an identity uncompressor with 'identity' content-encoding" do @response.stubs(:[]).with('content-encoding').returns 'identity' @uncompressor.uncompress(@response) { |u| - u.should be_instance_of Puppet::Network::HTTP::Compression::IdentityAdapter + u.should be_instance_of(Puppet::Network::HTTP::Compression::IdentityAdapter) } end @@ -135,7 +135,7 @@ describe "http compression" do it "should yield a Zlib uncompressor with '#{c}' content-encoding" do @response.stubs(:[]).with('content-encoding').returns c @uncompressor.uncompress(@response) { |u| - u.should be_instance_of Puppet::Network::HTTP::Compression::Active::ZlibAdapter + u.should be_instance_of(Puppet::Network::HTTP::Compression::Active::ZlibAdapter) } end end @@ -172,7 +172,7 @@ describe "http compression" do end it "should try a 'regular' inflater on Zlib::DataError" do - @inflater.expects(:inflate).raises(Zlib::DataError.new "not a zlib stream") + @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) inflater = stub_everything 'inflater2' inflater.expects(:inflate).with("chunk").returns("uncompressed") Zlib::Inflate.expects(:new).with().returns(inflater) @@ -180,7 +180,7 @@ describe "http compression" do end it "should raise the error the second time" do - @inflater.expects(:inflate).raises(Zlib::DataError.new "not a zlib stream") + @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) Zlib::Inflate.expects(:new).with().returns(@inflater) lambda { @adapter.uncompress("chunk") }.should raise_error end diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index df73645a2..9d3cab712 100644 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -36,13 +36,13 @@ describe Puppet::Parser::AST::InOperator do end it "should raise an argument error if rval doesn't support the include? method" do - @rval.expects(:safeevaluate).with(@scope).returns(stub 'value') + @rval.expects(:safeevaluate).with(@scope).returns(stub('value')) lambda { @operator.evaluate(@scope) }.should raise_error end it "should not raise an argument error if rval supports the include? method" do - @rval.expects(:safeevaluate).with(@scope).returns(stub 'value', :include? => true) + @rval.expects(:safeevaluate).with(@scope).returns(stub('value', :include? => true)) lambda { @operator.evaluate(@scope) }.should_not raise_error end diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index fe59b9c57..54fb2978c 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -267,7 +267,7 @@ describe Puppet::Type do Puppet::Type.type(:mount).any_instance.stubs(:newattr).with do |param, hash| set << param true - end.returns(stub_everything "a property") + end.returns(stub_everything("a property")) Puppet::Type.type(:mount).new(resource) @@ -284,7 +284,7 @@ describe Puppet::Type do Puppet::Type.type(:mount).any_instance.stubs(:newattr).with do |param, hash| set << param true - end.returns(stub_everything "a property") + end.returns(stub_everything("a property")) Puppet::Type.type(:mount).new(resource) set[0].should == :name -- cgit From 0aae5a71a8e3b38cd8d7041f5c40091887c924a8 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 28 Jun 2010 15:27:44 -0700 Subject: maint: Fixing tests that fail when run as root Commit ae520057280c2454bc44c64ac1e6686bf2eb086d introduced some code that used 'asuser' which does nothing when not run as root, but in these tests tries to run as a non-existent user. Stubbing out the asuser method to just yield prevents test failures when running as root. --- spec/unit/provider/ssh_authorized_key/parsed_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index f8613e35e..e60ba2797 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -44,6 +44,7 @@ describe provider_class do @provider.stubs(:filetype).returns(Puppet::Util::FileType::FileTypeRam) File.stubs(:chown) File.stubs(:chmod) + Puppet::Util::SUIDManager.stubs(:asuser).yields key.flush @provider.target_object(@keyfile).read end @@ -99,6 +100,7 @@ describe provider_class do @provider = provider_class.new(@resource) provider_class.stubs(:filetype).returns(Puppet::Util::FileType::FileTypeRam) + Puppet::Util::SUIDManager.stubs(:asuser).yields end describe "when flushing" do -- cgit