Browse files

test cleanup, replace `define_method` and `remove_method` with stubs.

  • Loading branch information...
1 parent 5a687e9 commit 1c998a7f131a844ed58d94b70b3f5d9ef071a259 @senny senny committed May 27, 2013
Showing with 1 addition and 5 deletions.
  1. +1 −5 activerecord/test/cases/adapters/postgresql/active_schema_test.rb
View
6 activerecord/test/cases/adapters/postgresql/active_schema_test.rb
@@ -25,9 +25,7 @@ def test_create_database_with_collation_and_ctype
def test_add_index
# add_index calls index_name_exists? which can't work since execute is stubbed
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:define_method, :index_name_exists?) do |*|
- false
- end
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.stubs(:index_name_exists?).returns(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'")
@@ -51,8 +49,6 @@ def test_add_index
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
private

0 comments on commit 1c998a7

Please sign in to comment.