diff options
author | Matthew Draper <matthew@trebex.net> | 2015-09-07 01:07:51 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-09-07 01:11:51 +0930 |
commit | f1f0a3f8d99aef8aacfa81ceac3880dcac03ca06 (patch) | |
tree | 65013af4d379038444e8827ac3a8a9660e356131 /activerecord/test/cases/adapters | |
parent | 096252795341518c04e1bb47a32450ade7d7e169 (diff) | |
download | rails-f1f0a3f8d99aef8aacfa81ceac3880dcac03ca06.tar.gz rails-f1f0a3f8d99aef8aacfa81ceac3880dcac03ca06.tar.bz2 rails-f1f0a3f8d99aef8aacfa81ceac3880dcac03ca06.zip |
Fix test failures from premature merge of #21317
Apparently I managed to forget how similar the "tests passing" and
"no status reported" merge indicators look.
Note that the previous `stubs` in test_add_index wasn't working:
the method was still called, and just happened to return false.
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/active_schema_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb index d0f5f56786..24def31e36 100644 --- a/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +++ b/activerecord/test/cases/adapters/postgresql/active_schema_test.rb @@ -25,7 +25,7 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase def test_add_index # add_index calls index_name_exists? which can't work since execute is stubbed - ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.stubs(:index_name_exists?).returns(false) + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:define_method, :index_name_exists?) { |*| false } expected = %(CREATE UNIQUE INDEX "index_people_on_last_name" ON "people" ("last_name") WHERE state = 'active') assert_equal expected, add_index(:people, :last_name, :unique => true, :where => "state = 'active'") @@ -49,15 +49,22 @@ class PostgresqlActiveSchemaTest < ActiveRecord::PostgreSQLTestCase expected = %(CREATE UNIQUE INDEX "index_people_on_last_name" ON "people" USING gist ("last_name") WHERE state = 'active') assert_equal expected, add_index(:people, :last_name, :unique => true, :where => "state = 'active'", :using => :gist) + + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :remove_method, :index_name_exists? 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 } + expected = %(DROP INDEX CONCURRENTLY "index_people_on_last_name") assert_equal expected, remove_index(:people, name: "index_people_on_last_name", algorithm: :concurrently) assert_raise ArgumentError do add_index(:people, :last_name, algorithm: :copy) end + + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send :remove_method, :index_name_exists? end private |