diff options
author | Marcelo Silveira <marcelo@mhfs.com.br> | 2012-02-09 19:04:07 -0200 |
---|---|---|
committer | Marcelo Silveira <marcelo@mhfs.com.br> | 2012-02-09 19:04:07 -0200 |
commit | aaffc2acd5fa3104fa936c334ef9d50774071c8b (patch) | |
tree | 95b633ea86955ef3ac7b853ed5af6398947330df /activerecord | |
parent | 7ef22fce7cdb955aba3b2f45629a711592336b1f (diff) | |
download | rails-aaffc2acd5fa3104fa936c334ef9d50774071c8b.tar.gz rails-aaffc2acd5fa3104fa936c334ef9d50774071c8b.tar.bz2 rails-aaffc2acd5fa3104fa936c334ef9d50774071c8b.zip |
improved test case for partial indices
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration/index_test.rb | 15 |
1 files changed, 9 insertions, 6 deletions
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 |