aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-05-02 04:10:59 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-05-02 04:16:15 +0900
commite24eeef3d42eac4f6fdd9a63bcde2a054e839af9 (patch)
tree3a775b4cf2ee047c6fd1f3a9f8e0a4ddaac88ba2 /activerecord
parent5175f5bf786439cd85237ed924f6c2dc6214851b (diff)
downloadrails-e24eeef3d42eac4f6fdd9a63bcde2a054e839af9.tar.gz
rails-e24eeef3d42eac4f6fdd9a63bcde2a054e839af9.tar.bz2
rails-e24eeef3d42eac4f6fdd9a63bcde2a054e839af9.zip
More exercise `test_remove_named_index`
Ensure that do not accidentally remove an index of different definitions.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/migration/index_test.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb
index f9b2dc0c73..f8fecc83cd 100644
--- a/activerecord/test/cases/migration/index_test.rb
+++ b/activerecord/test/cases/migration/index_test.rb
@@ -135,9 +135,12 @@ module ActiveRecord
end
def test_remove_named_index
- connection.add_index :testings, :foo, name: "custom_index_name"
+ connection.add_index :testings, :foo, name: "index_testings_on_custom_index_name"
assert connection.index_exists?(:testings, :foo)
+
+ assert_raise(ArgumentError) { connection.remove_index(:testings, "custom_index_name") }
+
connection.remove_index :testings, :foo
assert_not connection.index_exists?(:testings, :foo)
end