diff options
Diffstat (limited to 'spec/unit/resource/mount_spec.rb')
-rw-r--r-- | spec/unit/resource/mount_spec.rb | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index 0a154342c7..ad95c06e04 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -25,150 +25,150 @@ describe Chef::Resource::Mount do end it "should create a new Chef::Resource::Mount" do - @resource.should be_a_kind_of(Chef::Resource) - @resource.should be_a_kind_of(Chef::Resource::Mount) + expect(@resource).to be_a_kind_of(Chef::Resource) + expect(@resource).to be_a_kind_of(Chef::Resource::Mount) end it "should have a name" do - @resource.name.should eql("filesystem") + expect(@resource.name).to eql("filesystem") end it "should set mount_point to the name" do - @resource.mount_point.should eql("filesystem") + expect(@resource.mount_point).to eql("filesystem") end it "should have a default action of mount" do - @resource.action.should eql(:mount) + expect(@resource.action).to eql(:mount) end it "should accept mount, umount and remount as actions" do - lambda { @resource.action :mount }.should_not raise_error - lambda { @resource.action :umount }.should_not raise_error - lambda { @resource.action :remount }.should_not raise_error - lambda { @resource.action :brooklyn }.should raise_error(ArgumentError) + expect { @resource.action :mount }.not_to raise_error + expect { @resource.action :umount }.not_to raise_error + expect { @resource.action :remount }.not_to raise_error + expect { @resource.action :brooklyn }.to raise_error(ArgumentError) end it "should allow you to set the device attribute" do @resource.device "/dev/sdb3" - @resource.device.should eql("/dev/sdb3") + expect(@resource.device).to eql("/dev/sdb3") end it "should set fsck_device to '-' by default" do - @resource.fsck_device.should eql('-') + expect(@resource.fsck_device).to eql('-') end it "should allow you to set the fsck_device attribute" do @resource.fsck_device "/dev/rdsk/sdb3" - @resource.fsck_device.should eql("/dev/rdsk/sdb3") + expect(@resource.fsck_device).to eql("/dev/rdsk/sdb3") end it "should allow you to set the fstype attribute" do @resource.fstype "nfs" - @resource.fstype.should eql("nfs") + expect(@resource.fstype).to eql("nfs") end it "should allow you to set the dump attribute" do @resource.dump 1 - @resource.dump.should eql(1) + expect(@resource.dump).to eql(1) end it "should allow you to set the pass attribute" do @resource.pass 1 - @resource.pass.should eql(1) + expect(@resource.pass).to eql(1) end it "should set the options attribute to defaults" do - @resource.options.should eql(["defaults"]) + expect(@resource.options).to eql(["defaults"]) end it "should allow options to be sent as a string, and convert to array" do @resource.options "rw,noexec" - @resource.options.should be_a_kind_of(Array) + expect(@resource.options).to be_a_kind_of(Array) end it "should allow options attribute as an array" do @resource.options ["ro", "nosuid"] - @resource.options.should be_a_kind_of(Array) + expect(@resource.options).to be_a_kind_of(Array) end it "should allow options to be sent as a delayed evaluator" do @resource.options Chef::DelayedEvaluator.new {["rw", "noexec"]} - @resource.options.should eql(["rw", "noexec"]) + expect(@resource.options).to eql(["rw", "noexec"]) end it "should allow options to be sent as a delayed evaluator, and convert to array" do @resource.options Chef::DelayedEvaluator.new {"rw,noexec"} - @resource.options.should be_a_kind_of(Array) - @resource.options.should eql(["rw", "noexec"]) + expect(@resource.options).to be_a_kind_of(Array) + expect(@resource.options).to eql(["rw", "noexec"]) end it "should accept true for mounted" do @resource.mounted(true) - @resource.mounted.should eql(true) + expect(@resource.mounted).to eql(true) end it "should accept false for mounted" do @resource.mounted(false) - @resource.mounted.should eql(false) + expect(@resource.mounted).to eql(false) end it "should set mounted to false by default" do - @resource.mounted.should eql(false) + expect(@resource.mounted).to eql(false) end it "should not accept a string for mounted" do - lambda { @resource.mounted("poop") }.should raise_error(ArgumentError) + expect { @resource.mounted("poop") }.to raise_error(ArgumentError) end it "should accept true for enabled" do @resource.enabled(true) - @resource.enabled.should eql(true) + expect(@resource.enabled).to eql(true) end it "should accept false for enabled" do @resource.enabled(false) - @resource.enabled.should eql(false) + expect(@resource.enabled).to eql(false) end it "should set enabled to false by default" do - @resource.enabled.should eql(false) + expect(@resource.enabled).to eql(false) end it "should not accept a string for enabled" do - lambda { @resource.enabled("poop") }.should raise_error(ArgumentError) + expect { @resource.enabled("poop") }.to raise_error(ArgumentError) end it "should default all feature support to false" do support_hash = { :remount => false } - @resource.supports.should == support_hash + expect(@resource.supports).to eq(support_hash) end it "should allow you to set feature support as an array" do support_array = [ :remount ] support_hash = { :remount => true } @resource.supports(support_array) - @resource.supports.should == support_hash + expect(@resource.supports).to eq(support_hash) end it "should allow you to set feature support as a hash" do support_hash = { :remount => true } @resource.supports(support_hash) - @resource.supports.should == support_hash + expect(@resource.supports).to eq(support_hash) end it "should allow you to set username" do @resource.username("Administrator") - @resource.username.should == "Administrator" + expect(@resource.username).to eq("Administrator") end it "should allow you to set password" do @resource.password("Jetstream123!") - @resource.password.should == "Jetstream123!" + expect(@resource.password).to eq("Jetstream123!") end it "should allow you to set domain" do @resource.domain("TEST_DOMAIN") - @resource.domain.should == "TEST_DOMAIN" + expect(@resource.domain).to eq("TEST_DOMAIN") end describe "when it has mount point, device type, and fstype" do @@ -181,13 +181,13 @@ describe Chef::Resource::Mount do it "describes its state" do state = @resource.state - state[:mount_point].should == "123.456" - state[:device_type].should eql(:device) - state[:fstype].should == "ranked" + expect(state[:mount_point]).to eq("123.456") + expect(state[:device_type]).to eql(:device) + expect(state[:fstype]).to eq("ranked") end it "returns the device as its identity" do - @resource.identity.should == "charmander" + expect(@resource.identity).to eq("charmander") end end @@ -202,12 +202,12 @@ describe Chef::Resource::Mount do it "describes its state" do state = @resource.state - state[:mount_point].should == "T:" - state[:username].should == "Administrator" - state[:password].should == "Jetstream123!" - state[:domain].should == "TEST_DOMAIN" - state[:device_type].should eql(:device) - state[:fstype].should == "auto" + expect(state[:mount_point]).to eq("T:") + expect(state[:username]).to eq("Administrator") + expect(state[:password]).to eq("Jetstream123!") + expect(state[:domain]).to eq("TEST_DOMAIN") + expect(state[:device_type]).to eql(:device) + expect(state[:fstype]).to eq("auto") end end |