diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-02 17:56:26 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 16:24:31 -0800 |
commit | d6289aadce1b8fa93e799500e52f92ce8d159d6f (patch) | |
tree | 3976c159639791690f9202698104be54f201a624 /activerecord/test/cases | |
parent | 4e194ed1e68c13901f486334a5a1e9f509b10722 (diff) | |
download | rails-d6289aadce1b8fa93e799500e52f92ce8d159d6f.tar.gz rails-d6289aadce1b8fa93e799500e52f92ce8d159d6f.tar.bz2 rails-d6289aadce1b8fa93e799500e52f92ce8d159d6f.zip |
Fix test_any in relations_test.rb, which was failing when relations_test.rb is run on its own (it passes when the entire suite is run). This is a hacky fix for a problem I didn't quite get to the bottom of, so I'd welcome a better solution...
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index ed6ea4db0a..cd774ce343 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -640,6 +640,14 @@ class RelationTest < ActiveRecord::TestCase def test_any posts = Post.scoped + # This test was failing when run on its own (as opposed to running the entire suite). + # The second line in the assert_queries block was causing visit_Arel_Attributes_Attribute + # in Arel::Visitors::ToSql to trigger a SHOW TABLES query. Running that line here causes + # the SHOW TABLES result to be cached so we don't have to do it again in the block. + # + # This is obviously a rubbish fix but it's the best I can come up with for now... + posts.where(:id => nil).any? + assert_queries(3) do assert posts.any? # Uses COUNT() assert ! posts.where(:id => nil).any? |