Permalink
Browse files

improve description

  • Loading branch information...
1 parent 0a66e44 commit be7a0ab458decd845eac7e33ceac19dad73070e3 @delwyn committed Sep 28, 2012
Showing with 8 additions and 1 deletion.
  1. +4 −0 lib/cancan/matchers.rb
  2. +4 −1 spec/cancan/matchers_spec.rb
View
@@ -32,4 +32,8 @@ def ability_can?(ability, *args)
message << " but was able to #{(@actions - @errors).inspect}" if args.first.kind_of?(Array)
message
end
+
+ description do
+ "be able to #{args.map(&:inspect).join(" ")}"
+ end
end
@@ -31,6 +31,10 @@
end.should raise_error('expected to be able to :read 123 456')
end
+ it "has a nice description" do
+ be_able_to(:read, 123).description.should eq 'be able to :read 123'
+ end
+
describe "multiple checks" do
let(:object) { Object.new }
@@ -40,7 +44,6 @@
object.should be_able_to([:read, :update], 123)
end
-
it "reports a nice failure message for should when all fail" do
object.should_receive(:can?).with(:read, 123) { false }
object.should_receive(:can?).with(:update, 123) { false }

0 comments on commit be7a0ab

Please sign in to comment.