diff --git a/spec/cancan/ability_spec.rb b/spec/cancan/ability_spec.rb index cb60d3e..c7c489f 100644 --- a/spec/cancan/ability_spec.rb +++ b/spec/cancan/ability_spec.rb @@ -305,15 +305,15 @@ describe CanCan::Ability do @ability.can?(:read, "foobar" => Range).should be_false @ability.can?(:read, 123 => Range).should be_true end - + it "passing a hash of subjects with multiple definitions should check permissions correctly" do @ability.can :read, Range, :string => {:length => 4} @ability.can [:create, :read], Range, :string => {:upcase => 'FOO'} @ability.can?(:read, "foo" => Range).should be_true @ability.can?(:read, "foobar" => Range).should be_false @ability.can?(:read, 1234 => Range).should be_true - end - + end + it "should allow to check ability on Hash-like object" do class Container < Hash; end @ability.can :read, Container diff --git a/spec/cancan/exceptions_spec.rb b/spec/cancan/exceptions_spec.rb index 62e4360..58e65b7 100644 --- a/spec/cancan/exceptions_spec.rb +++ b/spec/cancan/exceptions_spec.rb @@ -32,23 +32,23 @@ describe CanCan::AccessDenied do @exception.message.should == "Access denied!" end end - + describe "i18n in the default message" do after(:each) do I18n.backend = nil end - + it "uses i18n for the default message" do I18n.backend.store_translations :en, :unauthorized => {:default => "This is a different message"} @exception = CanCan::AccessDenied.new @exception.message.should == "This is a different message" end - + it "defaults to a nice message" do @exception = CanCan::AccessDenied.new @exception.message.should == "You are not authorized to access this page." end - + it "does not use translation if a message is given" do @exception = CanCan::AccessDenied.new("Hey! You're not welcome here") @exception.message.should == "Hey! You're not welcome here" diff --git a/spec/cancan/model_adapters/active_record_adapter_spec.rb b/spec/cancan/model_adapters/active_record_adapter_spec.rb index a9debdd..ae83a89 100644 --- a/spec/cancan/model_adapters/active_record_adapter_spec.rb +++ b/spec/cancan/model_adapters/active_record_adapter_spec.rb @@ -133,7 +133,7 @@ if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record" article1 = Article.create!(:secret => true, :category => category1) article2 = Article.create!(:secret => true, :category => category2) category1.articles.accessible_by(@ability).should == [article1] - end + end it "should raise an exception when trying to merge scope with other conditions" do @ability.can :read, Article, :published => true