diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 7 | ||||
-rw-r--r-- | activerecord/test/cases/helper.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/migration/command_recorder_test.rb | 12 |
3 files changed, 16 insertions, 7 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index be92b30131..325fc58958 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -385,13 +385,10 @@ class EagerAssociationTest < ActiveRecord::TestCase c.id = "PL" end - b = Book.create! do |t| - t.id = "UE" - end + b = Book.create! - Subscription.create!(:subscriber_id => "PL", :book_id => "UE") + Subscription.create!(:subscriber_id => "PL", :book_id => b.id) s.reload - s.books s.book_ids = s.book_ids end diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index fbb4ee6f7b..9644ac1b02 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -26,8 +26,8 @@ ActiveSupport::Deprecation.debug = true # Quote "type" if it's a reserved word for the current connection. QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') -# Enable Identity Map for testing -ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "false" ? false : true) +# Enable Identity Map only when ENV['IM'] is set to "true" +ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "true") def current_adapter?(*types) types.any? do |type| diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index ae531ebb4c..0f79c99e1a 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -86,6 +86,18 @@ module ActiveRecord assert_equal [:remove_index, [:table, {:column => [:one, :two]}]], remove end + def test_invert_add_index_with_name + @recorder.record :add_index, [:table, [:one, :two], {:name => "new_index"}] + remove = @recorder.inverse.first + assert_equal [:remove_index, [:table, {:name => "new_index"}]], remove + end + + def test_invert_add_index_with_no_options + @recorder.record :add_index, [:table, [:one, :two]] + remove = @recorder.inverse.first + assert_equal [:remove_index, [:table, {:column => [:one, :two]}]], remove + end + def test_invert_rename_index @recorder.record :rename_index, [:old, :new] rename = @recorder.inverse.first |