Permalink
Browse files

fix incorret arguments in cannot

  • Loading branch information...
dnagir committed Jun 25, 2012
1 parent ac8d4f9 commit bfc1bb274c6be56f76411c535b5032e8ab20f8a2
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/allowy/context.rb
  2. +6 −0 spec/context_spec.rb
View
@@ -34,7 +34,7 @@ def can?(action, subject, *args)
current_allowy.access_control_for!(subject).can?(action, subject, *args)
end
- def cannot?(*args)
+ def cannot?(action, subject, *args)
current_allowy.access_control_for!(subject).cannot?(action, subject, *args)
end
View
@@ -21,6 +21,12 @@ class SampleContext
subject.can?(:edit, 123)
end
+ it "should be able to check using cannot?" do
+ subject.current_allowy.should_receive(:access_control_for!).with(123).and_return access
+ access.should_receive(:cannot?).with(:edit, 123)
+ subject.cannot?(:edit, 123)
+ end
+
it "should call authorize!" do
access.should_receive(:authorize!).with :edit, 123
subject.current_allowy.stub(:access_control_for! => access)

0 comments on commit bfc1bb2

Please sign in to comment.