From bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 24 Oct 2014 18:12:50 -0700 Subject: updating resources/providers unit tests to rpsec3 mechanically generated patch using transpec 2.3.7 gem --- spec/unit/provider/user/solaris_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'spec/unit/provider/user/solaris_spec.rb') diff --git a/spec/unit/provider/user/solaris_spec.rb b/spec/unit/provider/user/solaris_spec.rb index d8bd0f9e75..ab9055bbd2 100644 --- a/spec/unit/provider/user/solaris_spec.rb +++ b/spec/unit/provider/user/solaris_spec.rb @@ -27,7 +27,7 @@ describe Chef::Provider::User::Solaris do p.current_resource = @current_resource # Prevent the useradd-based provider tests from trying to write /etc/shadow - p.stub(:write_shadow_file) + allow(p).to receive(:write_shadow_file) p end @@ -52,12 +52,12 @@ describe Chef::Provider::User::Solaris do @new_resource.password "hocus-pocus" # Let these tests run #write_shadow_file - provider.unstub(:write_shadow_file) + allow(provider).to receive(:write_shadow_file).and_call_original end it "should use its own shadow file writer to set the password" do - provider.should_receive(:write_shadow_file) - provider.stub(:shell_out!).and_return(true) + expect(provider).to receive(:write_shadow_file) + allow(provider).to receive(:shell_out!).and_return(true) provider.manage_user end @@ -66,13 +66,13 @@ describe Chef::Provider::User::Solaris do password_file.puts "adam:existingpassword:15441::::::" password_file.close provider.password_file = password_file.path - provider.stub(:shell_out!).and_return(true) + allow(provider).to receive(:shell_out!).and_return(true) # may not be able to write to /etc for tests... temp_file = Tempfile.new("shadow") - Tempfile.stub(:new).with("shadow", "/etc").and_return(temp_file) + allow(Tempfile).to receive(:new).with("shadow", "/etc").and_return(temp_file) @new_resource.password "verysecurepassword" provider.manage_user - ::File.open(password_file.path, "r").read.should =~ /adam:verysecurepassword:/ + expect(::File.open(password_file.path, "r").read).to match(/adam:verysecurepassword:/) password_file.unlink end end -- cgit v1.2.1