summaryrefslogtreecommitdiff
path: root/spec/unit/mixin/securable_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/mixin/securable_spec.rb')
-rw-r--r--spec/unit/mixin/securable_spec.rb354
1 files changed, 177 insertions, 177 deletions
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 10954083d8..714d6dedae 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -28,19 +28,19 @@ describe Chef::Mixin::Securable do
end
it "should accept a group name or id for group" do
- lambda { @securable.group "root" }.should_not raise_error
- lambda { @securable.group 123 }.should_not raise_error
- lambda { @securable.group "+bad:group" }.should raise_error(ArgumentError)
+ expect { @securable.group "root" }.not_to raise_error
+ expect { @securable.group 123 }.not_to raise_error
+ expect { @securable.group "+bad:group" }.to raise_error(ArgumentError)
end
it "should accept a user name or id for owner" do
- lambda { @securable.owner "root" }.should_not raise_error
- lambda { @securable.owner 123 }.should_not raise_error
- lambda { @securable.owner "+bad:owner" }.should raise_error(ArgumentError)
+ expect { @securable.owner "root" }.not_to raise_error
+ expect { @securable.owner 123 }.not_to raise_error
+ expect { @securable.owner "+bad:owner" }.to raise_error(ArgumentError)
end
it "allows the owner to be specified as #user" do
- @securable.should respond_to(:user)
+ expect(@securable).to respond_to(:user)
end
describe "unix-specific behavior" do
@@ -54,69 +54,69 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names with spaces and backslashes" do
- lambda { @securable.group 'test\ group' }.should_not raise_error
- lambda { @securable.owner 'test\ group' }.should_not raise_error
+ expect { @securable.group 'test\ group' }.not_to raise_error
+ expect { @securable.owner 'test\ group' }.not_to raise_error
end
it "should accept group/owner names that are a single character or digit" do
- lambda { @securable.group 'v' }.should_not raise_error
- lambda { @securable.group '1' }.should_not raise_error
- lambda { @securable.owner 'v' }.should_not raise_error
- lambda { @securable.owner '1' }.should_not raise_error
+ expect { @securable.group 'v' }.not_to raise_error
+ expect { @securable.group '1' }.not_to raise_error
+ expect { @securable.owner 'v' }.not_to raise_error
+ expect { @securable.owner '1' }.not_to raise_error
end
it "should not accept group/owner names starting with '-', '+', or '~'" do
- lambda { @securable.group '-test' }.should raise_error(ArgumentError)
- lambda { @securable.group '+test' }.should raise_error(ArgumentError)
- lambda { @securable.group '~test' }.should raise_error(ArgumentError)
- lambda { @securable.group 'te-st' }.should_not raise_error
- lambda { @securable.group 'te+st' }.should_not raise_error
- lambda { @securable.group 'te~st' }.should_not raise_error
- lambda { @securable.owner '-test' }.should raise_error(ArgumentError)
- lambda { @securable.owner '+test' }.should raise_error(ArgumentError)
- lambda { @securable.owner '~test' }.should raise_error(ArgumentError)
- lambda { @securable.owner 'te-st' }.should_not raise_error
- lambda { @securable.owner 'te+st' }.should_not raise_error
- lambda { @securable.owner 'te~st' }.should_not raise_error
+ expect { @securable.group '-test' }.to raise_error(ArgumentError)
+ expect { @securable.group '+test' }.to raise_error(ArgumentError)
+ expect { @securable.group '~test' }.to raise_error(ArgumentError)
+ expect { @securable.group 'te-st' }.not_to raise_error
+ expect { @securable.group 'te+st' }.not_to raise_error
+ expect { @securable.group 'te~st' }.not_to raise_error
+ expect { @securable.owner '-test' }.to raise_error(ArgumentError)
+ expect { @securable.owner '+test' }.to raise_error(ArgumentError)
+ expect { @securable.owner '~test' }.to raise_error(ArgumentError)
+ expect { @securable.owner 'te-st' }.not_to raise_error
+ expect { @securable.owner 'te+st' }.not_to raise_error
+ expect { @securable.owner 'te~st' }.not_to raise_error
end
it "should not accept group/owner names containing ':', ',' or non-space whitespace" do
- lambda { @securable.group ':test' }.should raise_error(ArgumentError)
- lambda { @securable.group 'te:st' }.should raise_error(ArgumentError)
- lambda { @securable.group ',test' }.should raise_error(ArgumentError)
- lambda { @securable.group 'te,st' }.should raise_error(ArgumentError)
- lambda { @securable.group "\ttest" }.should raise_error(ArgumentError)
- lambda { @securable.group "te\tst" }.should raise_error(ArgumentError)
- lambda { @securable.group "\rtest" }.should raise_error(ArgumentError)
- lambda { @securable.group "te\rst" }.should raise_error(ArgumentError)
- lambda { @securable.group "\ftest" }.should raise_error(ArgumentError)
- lambda { @securable.group "te\fst" }.should raise_error(ArgumentError)
- lambda { @securable.group "\0test" }.should raise_error(ArgumentError)
- lambda { @securable.group "te\0st" }.should raise_error(ArgumentError)
- lambda { @securable.owner ':test' }.should raise_error(ArgumentError)
- lambda { @securable.owner 'te:st' }.should raise_error(ArgumentError)
- lambda { @securable.owner ',test' }.should raise_error(ArgumentError)
- lambda { @securable.owner 'te,st' }.should raise_error(ArgumentError)
- lambda { @securable.owner "\ttest" }.should raise_error(ArgumentError)
- lambda { @securable.owner "te\tst" }.should raise_error(ArgumentError)
- lambda { @securable.owner "\rtest" }.should raise_error(ArgumentError)
- lambda { @securable.owner "te\rst" }.should raise_error(ArgumentError)
- lambda { @securable.owner "\ftest" }.should raise_error(ArgumentError)
- lambda { @securable.owner "te\fst" }.should raise_error(ArgumentError)
- lambda { @securable.owner "\0test" }.should raise_error(ArgumentError)
- lambda { @securable.owner "te\0st" }.should raise_error(ArgumentError)
+ expect { @securable.group ':test' }.to raise_error(ArgumentError)
+ expect { @securable.group 'te:st' }.to raise_error(ArgumentError)
+ expect { @securable.group ',test' }.to raise_error(ArgumentError)
+ expect { @securable.group 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.group "\ttest" }.to raise_error(ArgumentError)
+ expect { @securable.group "te\tst" }.to raise_error(ArgumentError)
+ expect { @securable.group "\rtest" }.to raise_error(ArgumentError)
+ expect { @securable.group "te\rst" }.to raise_error(ArgumentError)
+ expect { @securable.group "\ftest" }.to raise_error(ArgumentError)
+ expect { @securable.group "te\fst" }.to raise_error(ArgumentError)
+ expect { @securable.group "\0test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te\0st" }.to raise_error(ArgumentError)
+ expect { @securable.owner ':test' }.to raise_error(ArgumentError)
+ expect { @securable.owner 'te:st' }.to raise_error(ArgumentError)
+ expect { @securable.owner ',test' }.to raise_error(ArgumentError)
+ expect { @securable.owner 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.owner "\ttest" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te\tst" }.to raise_error(ArgumentError)
+ expect { @securable.owner "\rtest" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te\rst" }.to raise_error(ArgumentError)
+ expect { @securable.owner "\ftest" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te\fst" }.to raise_error(ArgumentError)
+ expect { @securable.owner "\0test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te\0st" }.to raise_error(ArgumentError)
end
it "should accept Active Directory-style domain names pulled in via LDAP (on unix hosts)" do
- lambda { @securable.owner "domain\@user" }.should_not raise_error
- lambda { @securable.owner "domain\\user" }.should_not raise_error
- lambda { @securable.group "domain\@group" }.should_not raise_error
- lambda { @securable.group "domain\\group" }.should_not raise_error
- lambda { @securable.group "domain\\group^name" }.should_not raise_error
+ expect { @securable.owner "domain\@user" }.not_to raise_error
+ expect { @securable.owner "domain\\user" }.not_to raise_error
+ expect { @securable.group "domain\@group" }.not_to raise_error
+ expect { @securable.group "domain\\group" }.not_to raise_error
+ expect { @securable.group "domain\\group^name" }.not_to raise_error
end
it "should not accept group/owner names containing embedded carriage returns" do
- pending "XXX: params_validate needs to be extended to support multi-line regex"
+ skip "XXX: params_validate needs to be extended to support multi-line regex"
#lambda { @securable.group "\ntest" }.should raise_error(ArgumentError)
#lambda { @securable.group "te\nst" }.should raise_error(ArgumentError)
#lambda { @securable.owner "\ntest" }.should raise_error(ArgumentError)
@@ -124,53 +124,53 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names in UTF-8" do
- lambda { @securable.group 'tëst' }.should_not raise_error
- lambda { @securable.group 'ë' }.should_not raise_error
- lambda { @securable.owner 'tëst' }.should_not raise_error
- lambda { @securable.owner 'ë' }.should_not raise_error
+ expect { @securable.group 'tëst' }.not_to raise_error
+ expect { @securable.group 'ë' }.not_to raise_error
+ expect { @securable.owner 'tëst' }.not_to raise_error
+ expect { @securable.owner 'ë' }.not_to raise_error
end
it "should accept a unix file mode in string form as an octal number" do
- lambda { @securable.mode "0" }.should_not raise_error
- lambda { @securable.mode "0000" }.should_not raise_error
- lambda { @securable.mode "0111" }.should_not raise_error
- lambda { @securable.mode "0444" }.should_not raise_error
-
- lambda { @securable.mode "111" }.should_not raise_error
- lambda { @securable.mode "444" }.should_not raise_error
- lambda { @securable.mode "7777" }.should_not raise_error
- lambda { @securable.mode "07777" }.should_not raise_error
-
- lambda { @securable.mode "-01" }.should raise_error(ArgumentError)
- lambda { @securable.mode "010000" }.should raise_error(ArgumentError)
- lambda { @securable.mode "-1" }.should raise_error(ArgumentError)
- lambda { @securable.mode "10000" }.should raise_error(ArgumentError)
-
- lambda { @securable.mode "07778" }.should raise_error(ArgumentError)
- lambda { @securable.mode "7778" }.should raise_error(ArgumentError)
- lambda { @securable.mode "4095" }.should raise_error(ArgumentError)
-
- lambda { @securable.mode "0foo1234" }.should raise_error(ArgumentError)
- lambda { @securable.mode "foo1234" }.should raise_error(ArgumentError)
+ expect { @securable.mode "0" }.not_to raise_error
+ expect { @securable.mode "0000" }.not_to raise_error
+ expect { @securable.mode "0111" }.not_to raise_error
+ expect { @securable.mode "0444" }.not_to raise_error
+
+ expect { @securable.mode "111" }.not_to raise_error
+ expect { @securable.mode "444" }.not_to raise_error
+ expect { @securable.mode "7777" }.not_to raise_error
+ expect { @securable.mode "07777" }.not_to raise_error
+
+ expect { @securable.mode "-01" }.to raise_error(ArgumentError)
+ expect { @securable.mode "010000" }.to raise_error(ArgumentError)
+ expect { @securable.mode "-1" }.to raise_error(ArgumentError)
+ expect { @securable.mode "10000" }.to raise_error(ArgumentError)
+
+ expect { @securable.mode "07778" }.to raise_error(ArgumentError)
+ expect { @securable.mode "7778" }.to raise_error(ArgumentError)
+ expect { @securable.mode "4095" }.to raise_error(ArgumentError)
+
+ expect { @securable.mode "0foo1234" }.to raise_error(ArgumentError)
+ expect { @securable.mode "foo1234" }.to raise_error(ArgumentError)
end
it "should accept a unix file mode in numeric form as a ruby-interpreted integer" do
- lambda { @securable.mode(0) }.should_not raise_error
- lambda { @securable.mode(0000) }.should_not raise_error
- lambda { @securable.mode(444) }.should_not raise_error
- lambda { @securable.mode(0444) }.should_not raise_error
- lambda { @securable.mode(07777) }.should_not raise_error
-
- lambda { @securable.mode(292) }.should_not raise_error
- lambda { @securable.mode(4095) }.should_not raise_error
-
- lambda { @securable.mode(0111) }.should_not raise_error
- lambda { @securable.mode(73) }.should_not raise_error
-
- lambda { @securable.mode(-01) }.should raise_error(ArgumentError)
- lambda { @securable.mode(010000) }.should raise_error(ArgumentError)
- lambda { @securable.mode(-1) }.should raise_error(ArgumentError)
- lambda { @securable.mode(4096) }.should raise_error(ArgumentError)
+ expect { @securable.mode(0) }.not_to raise_error
+ expect { @securable.mode(0000) }.not_to raise_error
+ expect { @securable.mode(444) }.not_to raise_error
+ expect { @securable.mode(0444) }.not_to raise_error
+ expect { @securable.mode(07777) }.not_to raise_error
+
+ expect { @securable.mode(292) }.not_to raise_error
+ expect { @securable.mode(4095) }.not_to raise_error
+
+ expect { @securable.mode(0111) }.not_to raise_error
+ expect { @securable.mode(73) }.not_to raise_error
+
+ expect { @securable.mode(-01) }.to raise_error(ArgumentError)
+ expect { @securable.mode(010000) }.to raise_error(ArgumentError)
+ expect { @securable.mode(-1) }.to raise_error(ArgumentError)
+ expect { @securable.mode(4096) }.to raise_error(ArgumentError)
end
end
@@ -187,94 +187,94 @@ describe Chef::Mixin::Securable do
end
it "should not accept a group name or id for group with spaces and multiple backslashes" do
- lambda { @securable.group 'test\ \group' }.should raise_error(ArgumentError)
+ expect { @securable.group 'test\ \group' }.to raise_error(ArgumentError)
end
it "should accept a unix file mode in string form as an octal number" do
- lambda { @securable.mode "0" }.should_not raise_error
- lambda { @securable.mode "0000" }.should_not raise_error
- lambda { @securable.mode "0111" }.should_not raise_error
- lambda { @securable.mode "0444" }.should_not raise_error
-
- lambda { @securable.mode "111" }.should_not raise_error
- lambda { @securable.mode "444" }.should_not raise_error
- lambda { @securable.mode "7777" }.should raise_error(ArgumentError)
- lambda { @securable.mode "07777" }.should raise_error(ArgumentError)
-
- lambda { @securable.mode "-01" }.should raise_error(ArgumentError)
- lambda { @securable.mode "010000" }.should raise_error(ArgumentError)
- lambda { @securable.mode "-1" }.should raise_error(ArgumentError)
- lambda { @securable.mode "10000" }.should raise_error(ArgumentError)
-
- lambda { @securable.mode "07778" }.should raise_error(ArgumentError)
- lambda { @securable.mode "7778" }.should raise_error(ArgumentError)
- lambda { @securable.mode "4095" }.should raise_error(ArgumentError)
-
- lambda { @securable.mode "0foo1234" }.should raise_error(ArgumentError)
- lambda { @securable.mode "foo1234" }.should raise_error(ArgumentError)
+ expect { @securable.mode "0" }.not_to raise_error
+ expect { @securable.mode "0000" }.not_to raise_error
+ expect { @securable.mode "0111" }.not_to raise_error
+ expect { @securable.mode "0444" }.not_to raise_error
+
+ expect { @securable.mode "111" }.not_to raise_error
+ expect { @securable.mode "444" }.not_to raise_error
+ expect { @securable.mode "7777" }.to raise_error(ArgumentError)
+ expect { @securable.mode "07777" }.to raise_error(ArgumentError)
+
+ expect { @securable.mode "-01" }.to raise_error(ArgumentError)
+ expect { @securable.mode "010000" }.to raise_error(ArgumentError)
+ expect { @securable.mode "-1" }.to raise_error(ArgumentError)
+ expect { @securable.mode "10000" }.to raise_error(ArgumentError)
+
+ expect { @securable.mode "07778" }.to raise_error(ArgumentError)
+ expect { @securable.mode "7778" }.to raise_error(ArgumentError)
+ expect { @securable.mode "4095" }.to raise_error(ArgumentError)
+
+ expect { @securable.mode "0foo1234" }.to raise_error(ArgumentError)
+ expect { @securable.mode "foo1234" }.to raise_error(ArgumentError)
end
it "should accept a unix file mode in numeric form as a ruby-interpreted integer" do
- lambda { @securable.mode 0 }.should_not raise_error
- lambda { @securable.mode 0000 }.should_not raise_error
- lambda { @securable.mode 444 }.should_not raise_error
- lambda { @securable.mode 0444 }.should_not raise_error
- lambda { @securable.mode 07777 }.should raise_error(ArgumentError)
-
- lambda { @securable.mode 292 }.should_not raise_error
- lambda { @securable.mode 4095 }.should raise_error(ArgumentError)
-
- lambda { @securable.mode 0111 }.should_not raise_error
- lambda { @securable.mode 73 }.should_not raise_error
-
- lambda { @securable.mode -01 }.should raise_error(ArgumentError)
- lambda { @securable.mode 010000 }.should raise_error(ArgumentError)
- lambda { @securable.mode -1 }.should raise_error(ArgumentError)
- lambda { @securable.mode 4096 }.should raise_error(ArgumentError)
+ expect { @securable.mode 0 }.not_to raise_error
+ expect { @securable.mode 0000 }.not_to raise_error
+ expect { @securable.mode 444 }.not_to raise_error
+ expect { @securable.mode 0444 }.not_to raise_error
+ expect { @securable.mode 07777 }.to raise_error(ArgumentError)
+
+ expect { @securable.mode 292 }.not_to raise_error
+ expect { @securable.mode 4095 }.to raise_error(ArgumentError)
+
+ expect { @securable.mode 0111 }.not_to raise_error
+ expect { @securable.mode 73 }.not_to raise_error
+
+ expect { @securable.mode -01 }.to raise_error(ArgumentError)
+ expect { @securable.mode 010000 }.to raise_error(ArgumentError)
+ expect { @securable.mode -1 }.to raise_error(ArgumentError)
+ expect { @securable.mode 4096 }.to raise_error(ArgumentError)
end
it "should allow you to specify :full_control, :modify, :read_execute, :read, and :write rights" do
- lambda { @securable.rights :full_control, "The Dude" }.should_not raise_error
- lambda { @securable.rights :modify, "The Dude" }.should_not raise_error
- lambda { @securable.rights :read_execute, "The Dude" }.should_not raise_error
- lambda { @securable.rights :read, "The Dude" }.should_not raise_error
- lambda { @securable.rights :write, "The Dude" }.should_not raise_error
- lambda { @securable.rights :to_party, "The Dude" }.should raise_error(ArgumentError)
+ expect { @securable.rights :full_control, "The Dude" }.not_to raise_error
+ expect { @securable.rights :modify, "The Dude" }.not_to raise_error
+ expect { @securable.rights :read_execute, "The Dude" }.not_to raise_error
+ expect { @securable.rights :read, "The Dude" }.not_to raise_error
+ expect { @securable.rights :write, "The Dude" }.not_to raise_error
+ expect { @securable.rights :to_party, "The Dude" }.to raise_error(ArgumentError)
end
it "should allow you to specify :full_control, :modify, :read_execute, :read, and :write deny_rights" do
- lambda { @securable.deny_rights :full_control, "The Dude" }.should_not raise_error
- lambda { @securable.deny_rights :modify, "The Dude" }.should_not raise_error
- lambda { @securable.deny_rights :read_execute, "The Dude" }.should_not raise_error
- lambda { @securable.deny_rights :read, "The Dude" }.should_not raise_error
- lambda { @securable.deny_rights :write, "The Dude" }.should_not raise_error
- lambda { @securable.deny_rights :to_party, "The Dude" }.should raise_error(ArgumentError)
+ expect { @securable.deny_rights :full_control, "The Dude" }.not_to raise_error
+ expect { @securable.deny_rights :modify, "The Dude" }.not_to raise_error
+ expect { @securable.deny_rights :read_execute, "The Dude" }.not_to raise_error
+ expect { @securable.deny_rights :read, "The Dude" }.not_to raise_error
+ expect { @securable.deny_rights :write, "The Dude" }.not_to raise_error
+ expect { @securable.deny_rights :to_party, "The Dude" }.to raise_error(ArgumentError)
end
it "should accept a principal as a string or an array" do
- lambda { @securable.rights :read, "The Dude" }.should_not raise_error
- lambda { @securable.rights :read, ["The Dude","Donny"] }.should_not raise_error
- lambda { @securable.rights :read, 3 }.should raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude" }.not_to raise_error
+ expect { @securable.rights :read, ["The Dude","Donny"] }.not_to raise_error
+ expect { @securable.rights :read, 3 }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies_to_children with true/false/:containers_only/:objects_only" do
- lambda { @securable.rights :read, "The Dude", :applies_to_children => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => :containers_only }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => :objects_only }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => 'poop' }.should raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => :containers_only }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => :objects_only }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => 'poop' }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies_to_self with true/false" do
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_self => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_self => 'poop' }.should raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_self => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_self => 'poop' }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies one_level_deep with true/false" do
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => 'poop' }.should raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => 'poop' }.to raise_error(ArgumentError)
end
it "should allow multiple rights and deny_rights declarations" do
@@ -283,32 +283,32 @@ describe Chef::Mixin::Securable do
@securable.rights :full_control, "The Dude"
@securable.rights :write, "The Dude"
@securable.deny_rights :read, "The Dude"
- @securable.rights.size.should == 3
- @securable.deny_rights.size.should == 2
+ expect(@securable.rights.size).to eq(3)
+ expect(@securable.deny_rights.size).to eq(2)
end
it "should allow you to specify whether the permission applies_to_self only if you specified applies_to_children" do
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => false }.should raise_error(ArgumentError)
- lambda { @securable.rights :read, "The Dude", :applies_to_self => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_self => false }.should_not raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => false }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_self => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_self => false }.not_to raise_error
end
it "should allow you to specify whether the permission applies one_level_deep only if you specified applies_to_children" do
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => true }.should raise_error(ArgumentError)
- lambda { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => false }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :one_level_deep => true }.should_not raise_error
- lambda { @securable.rights :read, "The Dude", :one_level_deep => false }.should_not raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => true }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :one_level_deep => true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", :one_level_deep => false }.not_to raise_error
end
it "should allow you to specify whether the permissions inherit with true/false" do
- lambda { @securable.inherits true }.should_not raise_error
- lambda { @securable.inherits false }.should_not raise_error
- lambda { @securable.inherits "monkey" }.should raise_error(ArgumentError)
+ expect { @securable.inherits true }.not_to raise_error
+ expect { @securable.inherits false }.not_to raise_error
+ expect { @securable.inherits "monkey" }.to raise_error(ArgumentError)
end
end
end