diff options
author | Aleksey Magusev <lexmag@gmail.com> | 2012-06-30 02:23:20 +0400 |
---|---|---|
committer | Aleksey Magusev <lexmag@gmail.com> | 2012-06-30 22:12:16 +0400 |
commit | 59e23e2ff22c0deb770af768c4cc04bd1b2c2ad7 (patch) | |
tree | c5c8bea7287f9d98f47fbe9b91539106ada4700b /activerecord/test/cases | |
parent | d79ca9288e5c55563a554d05c779a41e701181cd (diff) | |
download | rails-59e23e2ff22c0deb770af768c4cc04bd1b2c2ad7.tar.gz rails-59e23e2ff22c0deb770af768c4cc04bd1b2c2ad7.tar.bz2 rails-59e23e2ff22c0deb770af768c4cc04bd1b2c2ad7.zip |
Add more options to column_exists? method
Also fix failures in check options for nil
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/migration/change_schema_test.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index ab61a4dcef..ce9be66069 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -291,14 +291,20 @@ module ActiveRecord def test_column_exists_with_definition connection.create_table :testings do |t| - t.column :foo, :string, :limit => 100 - t.column :bar, :decimal, :precision => 8, :scale => 2 + t.column :foo, :string, limit: 100 + t.column :bar, :decimal, precision: 8, scale: 2 + t.column :taggable_id, :integer, null: false + t.column :taggable_type, :string, default: 'Photo' end - assert connection.column_exists?(:testings, :foo, :string, :limit => 100) - refute connection.column_exists?(:testings, :foo, :string, :limit => 50) - assert connection.column_exists?(:testings, :bar, :decimal, :precision => 8, :scale => 2) - refute connection.column_exists?(:testings, :bar, :decimal, :precision => 10, :scale => 2) + assert connection.column_exists?(:testings, :foo, :string, limit: 100) + refute connection.column_exists?(:testings, :foo, :string, limit: nil) + assert connection.column_exists?(:testings, :bar, :decimal, precision: 8, scale: 2) + refute connection.column_exists?(:testings, :bar, :decimal, precision: nil, scale: nil) + assert connection.column_exists?(:testings, :taggable_id, :integer, null: false) + refute connection.column_exists?(:testings, :taggable_id, :integer, null: true) + assert connection.column_exists?(:testings, :taggable_type, :string, default: 'Photo') + refute connection.column_exists?(:testings, :taggable_type, :string, default: nil) end def test_column_exists_on_table_with_no_options_parameter_supplied |