diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-25 18:14:09 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-10-25 18:14:09 +0000 |
commit | 17d3fd316551660ad19251b969540dc304a9a48c (patch) | |
tree | b0ec95db37cca6a37a7cf2f70580486d27193071 /activerecord/test | |
parent | 49bee8826acb2ec4dc638fd42b69342913e21ac5 (diff) | |
download | rails-17d3fd316551660ad19251b969540dc304a9a48c.tar.gz rails-17d3fd316551660ad19251b969540dc304a9a48c.tar.bz2 rails-17d3fd316551660ad19251b969540dc304a9a48c.zip |
r2736@asus: jeremy | 2005-10-24 17:08:12 -0700
Test for eager associations with limits should not assume that records are ordered by id.
r2737@asus: jeremy | 2005-10-24 19:06:09 -0700
Fail fast if invalid primary key column.
r2746@asus: jeremy | 2005-10-25 15:37:28 -0700
Begin rollback of fixture delete order. Its solves a problem for 1% of users who already have a workaround while severely slowing down the other 99%.
r2747@asus: jeremy | 2005-10-25 16:03:01 -0700
Rollback the rest.
r2748@asus: jeremy | 2005-10-25 16:06:26 -0700
Re-add fixtures declaration to conditions scoping test
r2749@asus: jeremy | 2005-10-25 16:09:03 -0700
Re-add fixtures declaration to finder test
r2750@asus: jeremy | 2005-10-25 16:13:50 -0700
Don't assume keyboards table is empty
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2730 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/associations_go_eager_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/conditions_scoping_test.rb | 1 | ||||
-rwxr-xr-x | activerecord/test/fixtures_test.rb | 81 | ||||
-rw-r--r-- | activerecord/test/pk_test.rb | 1 |
4 files changed, 3 insertions, 82 deletions
diff --git a/activerecord/test/associations_go_eager_test.rb b/activerecord/test/associations_go_eager_test.rb index 3dccc8e65a..c2e903fa2c 100644 --- a/activerecord/test/associations_go_eager_test.rb +++ b/activerecord/test/associations_go_eager_test.rb @@ -96,7 +96,7 @@ class EagerAssociationTest < Test::Unit::TestCase end def test_eager_with_has_many_and_limit - posts = Post.find(:all, :include => [ :author, :comments ], :limit => 2) + posts = Post.find(:all, :order => 'posts.id asc', :include => [ :author, :comments ], :limit => 2) assert_equal 2, posts.size assert_equal 3, posts.inject(0) { |sum, post| sum += post.comments.size } end diff --git a/activerecord/test/conditions_scoping_test.rb b/activerecord/test/conditions_scoping_test.rb index 4fc9aad64e..b945593b57 100644 --- a/activerecord/test/conditions_scoping_test.rb +++ b/activerecord/test/conditions_scoping_test.rb @@ -85,6 +85,7 @@ class HasAndBelongsToManyScopingTest< Test::Unit::TestCase assert_equal 0, @welcome.categories.find_all_by_type('SpecialCategory').size assert_equal 2, @welcome.categories.find_all_by_type('Category').size end + end diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index b5e49999f4..888d743078 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -86,7 +86,6 @@ class FixturesTest < Test::Unit::TestCase secondRow = ActiveRecord::Base.connection.select_one("SELECT * FROM prefix_topics_suffix WHERE author_name = 'Mary'") assert_nil(secondRow["author_email_address"]) ensure - Fixtures.all_loaded_fixtures.delete(topics) ActiveRecord::Base.connection.drop_table :prefix_topics_suffix rescue nil end @@ -290,83 +289,3 @@ class ForeignKeyFixturesTest < Test::Unit::TestCase assert true end end - - -class FixtureCleanup1Test < Test::Unit::TestCase - fixtures :topics - - def test_isolation - assert_equal 0, Developer.count - assert_equal 2, Topic.count - end -end - -class FixtureCleanup2Test < Test::Unit::TestCase - fixtures :developers - - def test_isolation - assert_equal 0, Topic.count - assert_equal 10, Developer.count - end -end - -class FixtureCleanup3Test < FixtureCleanup2Test - self.use_transactional_fixtures = false - - def test_dirty_fixture_table_names - assert_equal %w(developers), dirty_fixture_table_names - assert_equal %w(developers), loaded_fixture_table_names - assert_equal %w(developers), fixture_table_names - end -end - -class FixtureCleanup4Test < FixtureCleanup2Test - self.use_transactional_fixtures = true - - def test_dirty_fixture_table_names - assert_equal [], dirty_fixture_table_names - assert_equal %w(developers), loaded_fixture_table_names - assert_equal %w(developers), fixture_table_names - end -end - -class FixtureCleanup5Test < FixtureCleanup3Test - self.use_instantiated_fixtures = false - - def test_dirty_fixture_table_names - assert_equal %w(developers), dirty_fixture_table_names - assert_equal %w(developers), loaded_fixture_table_names - assert_equal %w(developers), fixture_table_names - end -end - -class FixtureCleanup6Test < FixtureCleanup4Test - self.use_instantiated_fixtures = true - - def test_dirty_fixture_table_names - assert_equal [], dirty_fixture_table_names - assert_equal %w(developers), loaded_fixture_table_names - assert_equal %w(developers), fixture_table_names - end -end - -class FixtureCleanup7Test < Test::Unit::TestCase - self.use_transactional_fixtures = false - self.use_instantiated_fixtures = true - - def test_dirty_fixture_table_names - assert_equal [], dirty_fixture_table_names - assert_equal [], loaded_fixture_table_names - assert_equal [], fixture_table_names - end - - def test_isolation - assert_equal 0, Topic.count - assert_equal 0, Developer.count - end -end - -class FixtureCleanup8Test < FixtureCleanup7Test - self.use_transactional_fixtures = true - self.use_instantiated_fixtures = true -end diff --git a/activerecord/test/pk_test.rb b/activerecord/test/pk_test.rb index 13adc7eb76..f9cfd6f293 100644 --- a/activerecord/test/pk_test.rb +++ b/activerecord/test/pk_test.rb @@ -24,6 +24,7 @@ class PrimaryKeysTest < Test::Unit::TestCase end def test_customized_primary_key_auto_assigns_on_save + Keyboard.delete_all keyboard = Keyboard.new(:name => 'HHKB') assert_nothing_raised { keyboard.save! } assert_equal keyboard.id, Keyboard.find_by_name('HHKB').id |