Permalink
Browse files

improved test case for partial indices

  • Loading branch information...
1 parent 7ef22fc commit aaffc2acd5fa3104fa936c334ef9d50774071c8b @mhfs mhfs committed Feb 9, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 activerecord/test/cases/migration/index_test.rb
View
15 activerecord/test/cases/migration/index_test.rb
@@ -169,14 +169,17 @@ def test_add_index
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

0 comments on commit aaffc2a

Please sign in to comment.