Skip to content

Commit

Permalink
order is not guaranteed by this select, so add an order and call first!
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Mar 30, 2011
1 parent 6067d29 commit 58becf1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/test/cases/finder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_first_bang_missing
end

def test_model_class_responds_to_first_bang
assert_equal topics(:first), Topic.first!
assert_equal topics(:first), Topic.order(:id).first!
assert_raises ActiveRecord::RecordNotFound do
Topic.delete_all
Topic.first!
Expand Down

2 comments on commit 58becf1

@pixeltrix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negates the point of the test which was to test that the AR::Base delegates to scoped, maybe just assert instead:

def test_model_class_responds_to_first_bang
    assert Topic.first!
    assert_raises ActiveRecord::RecordNotFound do
        Topic.delete_all
        Topic.first!
    end
end

The same applies for test_model_class_responds_to last_bang

@tenderlove
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! you're right. I'll update it. Thanks!

Please sign in to comment.