aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorTim Connor <tim@wasabi.local>2010-09-17 16:31:25 +1200
committerJosé Valim <jose.valim@gmail.com>2010-09-18 20:49:31 +0200
commit37de59eacf8f6478e866309615af7381d41a5a14 (patch)
treee57a203a9e4400bd3e6acf78bac889b11929e531 /activerecord/test/cases
parent55d0d57bfc72c0bdbc81ae5d95c99729f16899af (diff)
downloadrails-37de59eacf8f6478e866309615af7381d41a5a14.tar.gz
rails-37de59eacf8f6478e866309615af7381d41a5a14.tar.bz2
rails-37de59eacf8f6478e866309615af7381d41a5a14.zip
Fix issue with remove_index and add unit test [#5645 state:resolved]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration_test.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 03a8cc90f6..bcae46c7e8 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -127,16 +127,17 @@ if ActiveRecord::Base.connection.supports_migrations?
def test_add_index_length_limit
good_index_name = 'x' * Person.connection.index_name_length
too_long_index_name = good_index_name + 'x'
- assert_nothing_raised { Person.connection.add_index("people", "first_name", :name => too_long_index_name) }
+ assert_raise(ArgumentError) { Person.connection.add_index("people", "first_name", :name => too_long_index_name) }
assert !Person.connection.index_name_exists?("people", too_long_index_name, false)
assert_nothing_raised { Person.connection.add_index("people", "first_name", :name => good_index_name) }
assert Person.connection.index_name_exists?("people", good_index_name, false)
+ Person.connection.remove_index("people", :name => good_index_name)
end
def test_remove_nonexistent_index
# we do this by name, so OpenBase is a wash as noted above
unless current_adapter?(:OpenBaseAdapter)
- assert_nothing_raised { Person.connection.remove_index("people", "no_such_index") }
+ assert_raise(ArgumentError) { Person.connection.remove_index("people", "no_such_index") }
end
end
@@ -154,7 +155,7 @@ if ActiveRecord::Base.connection.supports_migrations?
def test_double_add_index
unless current_adapter?(:OpenBaseAdapter)
Person.connection.add_index('people', [:first_name], :name => 'some_idx')
- assert_nothing_raised { Person.connection.add_index('people', [:first_name], :name => 'some_idx') }
+ assert_raise(ArgumentError) { Person.connection.add_index('people', [:first_name], :name => 'some_idx') }
end
end