diff options
author | Matthew Draper <matthew@trebex.net> | 2015-12-18 14:13:46 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-12-18 14:13:46 +1030 |
commit | c316ce9ba4d67045029c8463dc7e04ea04e9ddad (patch) | |
tree | cc7d3712208d40faf00c07eb4e61915f9de974de /activerecord/test/cases/adapters/postgresql | |
parent | 4a58aef7e3035e775b4cd6cc65575c8ed02cd8af (diff) | |
parent | 8ceb883b0630e0d010fbef0c621cc9690b0bcad6 (diff) | |
download | rails-c316ce9ba4d67045029c8463dc7e04ea04e9ddad.tar.gz rails-c316ce9ba4d67045029c8463dc7e04ea04e9ddad.tar.bz2 rails-c316ce9ba4d67045029c8463dc7e04ea04e9ddad.zip |
Merge pull request #19456 from greysteil/index-exists-behaviour
Ignore index name in `index_exists?` when not passed a name to check for
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/active_schema_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/schema_test.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index 24def31e36..ed44bf7362 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -54,8 +54,10 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase end def test_remove_index - # remove_index calls index_name_exists? which can't work since execute is stubbed - ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:define_method, :index_name_exists?) { |*| true } + # remove_index calls index_name_for_remove which can't work since execute is stubbed + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:define_method, :index_name_for_remove) do |*| + 'index_people_on_last_name' + end expected = %(DROP INDEX CONCURRENTLY "index_people_on_last_name") assert_equal expected, remove_index(:people, name: "index_people_on_last_name", algorithm: :concurrently) @@ -64,7 +66,7 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase add_index(:people, :last_name, algorithm: :copy) end - ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :remove_method, :index_name_exists? + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :remove_method, :index_name_for_remove end private diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb index 7c9169f6e2..da30ad8a62 100644 --- a/activerecord/test/cases/adapters/postgresql/schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb @@ -323,8 +323,6 @@ class SchemaTest < ActiveRecord::PostgreSQLTestCase def test_with_uppercase_index_name @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)" - assert_nothing_raised { @connection.remove_index "things", name: "#{SCHEMA_NAME}.things_Index"} - @connection.execute "CREATE INDEX \"things_Index\" ON #{SCHEMA_NAME}.things (name)" with_schema_search_path SCHEMA_NAME do assert_nothing_raised { @connection.remove_index "things", name: "things_Index"} |