diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-10-24 18:12:50 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-10-24 18:12:50 -0700 |
commit | bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a (patch) | |
tree | acc7a2d09b2cec8eed863218c0400cd15cd27854 /spec/unit/provider/user/solaris_spec.rb | |
parent | bdce1c5619fde7d277262df9336e06f73e4fc3f8 (diff) | |
download | chef-bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a.tar.gz |
updating resources/providers unit tests to rpsec3
mechanically generated patch using transpec 2.3.7 gem
Diffstat (limited to 'spec/unit/provider/user/solaris_spec.rb')
-rw-r--r-- | spec/unit/provider/user/solaris_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
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 |