aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-08-18 02:07:13 +0900
committerGitHub <noreply@github.com>2017-08-18 02:07:13 +0900
commit677ba214377d179a15a904c99b9357295c887d1c (patch)
tree6dfcefc4d34e1da558ecb7384ed7dc290a548844 /activerecord/test
parentd11d629feb2e848d2643f34fc56b15d5e7e50394 (diff)
parent334d5240b443cec71320d47a11ba33527937b30f (diff)
downloadrails-677ba214377d179a15a904c99b9357295c887d1c.tar.gz
rails-677ba214377d179a15a904c99b9357295c887d1c.tar.bz2
rails-677ba214377d179a15a904c99b9357295c887d1c.zip
Merge pull request #30294 from yahonda/move_test_index_is_created_for_both_timestamps_to_without_transaction
Move `test_index_is_created_for_both_timestamps` to `TimestampsWithou…
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/timestamp_test.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index ba0bc6c45d..5d3e2a175c 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -446,17 +446,6 @@ class TimestampTest < ActiveRecord::TestCase
toy = Toy.first
assert_equal ["created_at", "updated_at"], toy.send(:all_timestamp_attributes_in_model)
end
-
- def test_index_is_created_for_both_timestamps
- ActiveRecord::Base.connection.create_table(:foos, force: true) do |t|
- t.timestamps null: true, index: true
- end
-
- indexes = ActiveRecord::Base.connection.indexes("foos")
- assert_equal ["created_at", "updated_at"], indexes.flat_map(&:columns).sort
- ensure
- ActiveRecord::Base.connection.drop_table(:foos)
- end
end
class TimestampsWithoutTransactionTest < ActiveRecord::TestCase
@@ -475,4 +464,15 @@ class TimestampsWithoutTransactionTest < ActiveRecord::TestCase
assert_nil post.updated_at
end
end
+
+ def test_index_is_created_for_both_timestamps
+ ActiveRecord::Base.connection.create_table(:foos, force: true) do |t|
+ t.timestamps null: true, index: true
+ end
+
+ indexes = ActiveRecord::Base.connection.indexes("foos")
+ assert_equal ["created_at", "updated_at"], indexes.flat_map(&:columns).sort
+ ensure
+ ActiveRecord::Base.connection.drop_table(:foos)
+ end
end