summaryrefslogtreecommitdiff
path: root/spec/unit/resource/user_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
commitbd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a (patch)
treeacc7a2d09b2cec8eed863218c0400cd15cd27854 /spec/unit/resource/user_spec.rb
parentbdce1c5619fde7d277262df9336e06f73e4fc3f8 (diff)
downloadchef-bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a.tar.gz
updating resources/providers unit tests to rpsec3
mechanically generated patch using transpec 2.3.7 gem
Diffstat (limited to 'spec/unit/resource/user_spec.rb')
-rw-r--r--spec/unit/resource/user_spec.rb46
1 files changed, 23 insertions, 23 deletions
diff --git a/spec/unit/resource/user_spec.rb b/spec/unit/resource/user_spec.rb
index 70b866202b..f05de94fe0 100644
--- a/spec/unit/resource/user_spec.rb
+++ b/spec/unit/resource/user_spec.rb
@@ -24,51 +24,51 @@ describe Chef::Resource::User, "initialize" do
end
it "should create a new Chef::Resource::User" do
- @resource.should be_a_kind_of(Chef::Resource)
- @resource.should be_a_kind_of(Chef::Resource::User)
+ expect(@resource).to be_a_kind_of(Chef::Resource)
+ expect(@resource).to be_a_kind_of(Chef::Resource::User)
end
it "should set the resource_name to :user" do
- @resource.resource_name.should eql(:user)
+ expect(@resource.resource_name).to eql(:user)
end
it "should set the username equal to the argument to initialize" do
- @resource.username.should eql("adam")
+ expect(@resource.username).to eql("adam")
end
%w{comment uid gid home shell password}.each do |attrib|
it "should set #{attrib} to nil" do
- @resource.send(attrib).should eql(nil)
+ expect(@resource.send(attrib)).to eql(nil)
end
end
it "should set action to :create" do
- @resource.action.should eql(:create)
+ expect(@resource.action).to eql(:create)
end
it "should set supports[:manage_home] to false" do
- @resource.supports[:manage_home].should eql(false)
+ expect(@resource.supports[:manage_home]).to eql(false)
end
it "should set supports[:non_unique] to false" do
- @resource.supports[:non_unique].should eql(false)
+ expect(@resource.supports[:non_unique]).to eql(false)
end
it "should set force to false" do
- @resource.force.should eql(false)
+ expect(@resource.force).to eql(false)
end
%w{create remove modify manage lock unlock}.each do |action|
it "should allow action #{action}" do
- @resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym)
+ expect(@resource.allowed_actions.detect { |a| a == action.to_sym }).to eql(action.to_sym)
end
end
it "should accept domain users (@ or \ separator) on non-windows" do
- lambda { @resource.username "domain\@user" }.should_not raise_error
- @resource.username.should == "domain\@user"
- lambda { @resource.username "domain\\user" }.should_not raise_error
- @resource.username.should == "domain\\user"
+ expect { @resource.username "domain\@user" }.not_to raise_error
+ expect(@resource.username).to eq("domain\@user")
+ expect { @resource.username "domain\\user" }.not_to raise_error
+ expect(@resource.username).to eq("domain\\user")
end
end
@@ -80,11 +80,11 @@ end
it "should allow a string" do
@resource.send(attrib, "adam")
- @resource.send(attrib).should eql("adam")
+ expect(@resource.send(attrib)).to eql("adam")
end
it "should not allow a hash" do
- lambda { @resource.send(attrib, { :woot => "i found it" }) }.should raise_error(ArgumentError)
+ expect { @resource.send(attrib, { :woot => "i found it" }) }.to raise_error(ArgumentError)
end
end
end
@@ -97,16 +97,16 @@ end
it "should allow a string" do
@resource.send(attrib, "100")
- @resource.send(attrib).should eql("100")
+ expect(@resource.send(attrib)).to eql("100")
end
it "should allow an integer" do
@resource.send(attrib, 100)
- @resource.send(attrib).should eql(100)
+ expect(@resource.send(attrib)).to eql(100)
end
it "should not allow a hash" do
- lambda { @resource.send(attrib, { :woot => "i found it" }) }.should raise_error(ArgumentError)
+ expect { @resource.send(attrib, { :woot => "i found it" }) }.to raise_error(ArgumentError)
end
end
@@ -120,13 +120,13 @@ end
it "describes its state" do
state = @resource.state
- state[:uid].should == 123
- state[:gid].should == 456
- state[:home].should == "/usr/local/root/"
+ expect(state[:uid]).to eq(123)
+ expect(state[:gid]).to eq(456)
+ expect(state[:home]).to eq("/usr/local/root/")
end
it "returns the username as its identity" do
- @resource.identity.should == "root"
+ expect(@resource.identity).to eq("root")
end
end