return subject passed to authorize! - closes #314
This commit is contained in:
parent
5d97cfb236
commit
1ac8099f7a
|
@ -201,6 +201,7 @@ module CanCan
|
||||||
message ||= unauthorized_message(action, subject)
|
message ||= unauthorized_message(action, subject)
|
||||||
raise AccessDenied.new(message, action, subject)
|
raise AccessDenied.new(message, action, subject)
|
||||||
end
|
end
|
||||||
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def unauthorized_message(action, subject)
|
def unauthorized_message(action, subject)
|
||||||
|
|
|
@ -317,9 +317,11 @@ describe CanCan::Ability do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not raise access denied exception if ability is authorized to perform an action" do
|
it "should not raise access denied exception if ability is authorized to perform an action and return subject" do
|
||||||
@ability.can :read, :foo
|
@ability.can :read, :foo
|
||||||
lambda { @ability.authorize!(:read, :foo) }.should_not raise_error
|
lambda {
|
||||||
|
@ability.authorize!(:read, :foo).should == :foo
|
||||||
|
}.should_not raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should know when block is used in conditions" do
|
it "should know when block is used in conditions" do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user