Fixing Segmentation fault on aliasing

This commit is contained in:
fl00r
2012-06-23 18:25:13 +04:00
parent 5f1be25419
commit 925274d29a
2 changed files with 10 additions and 0 deletions

View File

@@ -87,6 +87,10 @@ describe CanCan::Ability do
@ability.can?(:increment, 123).should be_true
end
it "should raise an Error if alias target is an exist action" do
lambda{ @ability.alias_action :show, :to => :show }.should raise_error(CanCan::Error, "You can't specify target (show) as alias because it is real action name")
end
it "should always call block with arguments when passing no arguments to can" do
@ability.can do |action, object_class, object|
action.should == :foo