clearing leftover whitespace
This commit is contained in:
parent
944804183e
commit
112a995327
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user