Skip to content

Commit

Permalink
Spec: Test scope "with_read_marks_for" with #count
Browse files Browse the repository at this point in the history
Since Rails 4.1, a simple count() does not work for this scope.
Instead, the primary key must be provided as argument
  • Loading branch information
ledermann committed Apr 23, 2014
1 parent 25fa5af commit c8ea131
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/readable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
end

describe :with_read_marks_for do
it "should return readables" do
Email.with_read_marks_for(@reader).to_a.should == [@email1, @email2]
end

it "should be countable" do
Email.with_read_marks_for(@reader).count(:messageid).should == 2
end

it "should not allow invalid parameter" do
[ 42, nil, 'foo', :foo, {} ].each do |not_a_reader|
expect {
Expand Down

0 comments on commit c8ea131

Please sign in to comment.