raise an error when trying to make a rule with both hash conditions and a block - closes #269

This commit is contained in:
Ryan Bates
2011-03-08 17:20:32 -08:00
parent f9b181af05
commit 0de43c445b
2 changed files with 9 additions and 0 deletions

View File

@@ -357,6 +357,14 @@ describe CanCan::Ability do
@ability.model_adapter(model_class, :read).should == :adapter_instance
end
it "should raise an error when attempting to use a block with a hash condition since it's not likely what they want" do
lambda {
@ability.can :read, Array, :published => true do
false
end
}.should raise_error(CanCan::Error, "You are not able to supply a block with a hash of conditions in read Array ability. Use either one.")
end
describe "unauthorized message" do
after(:each) do
I18n.backend = nil