From aaffc2acd5fa3104fa936c334ef9d50774071c8b Mon Sep 17 00:00:00 2001 From: Marcelo Silveira Date: Thu, 9 Feb 2012 19:04:07 -0200 Subject: improved test case for partial indices --- activerecord/test/cases/migration/index_test.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'activerecord/test/cases/migration') diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb index c5a479fcdb..dd9492924c 100644 --- a/activerecord/test/cases/migration/index_test.rb +++ b/activerecord/test/cases/migration/index_test.rb @@ -169,14 +169,17 @@ module ActiveRecord connection.add_index("testings", ["last_name", "first_name"], :order => :desc) connection.remove_index("testings", ["last_name", "first_name"]) end - - # Selected adapters support partial indices - if current_adapter?(:PostgreSQLAdapter) - connection.add_index("testings", ["last_name"], :where => "first_name = 'john doe'") - connection.remove_index("testings", ["last_name"]) - end end + def test_add_partial_index + skip 'only on pg' unless current_adapter?(:PostgreSQLAdapter) + + connection.add_index("testings", "last_name", :where => "first_name = 'john doe'") + assert connection.index_exists?("testings", "last_name") + + connection.remove_index("testings", "last_name") + assert !connection.index_exists?("testings", "last_name") + end end end end -- cgit v1.2.3