aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorFederico Martinez <fed.x.gibson@gmail.com>2018-05-31 00:49:25 -0300
committerFederico Martinez <fed.x.gibson@gmail.com>2018-06-01 18:58:51 -0300
commit7ef9849e3d51c1f4a37af368b770d8fdb41883cd (patch)
tree271fc8d3c1da3b8edc049ae9853773802066b8cf /activerecord/test
parentc1844477a1461ffc9db3d899212f608c2a0c77c9 (diff)
downloadrails-7ef9849e3d51c1f4a37af368b770d8fdb41883cd.tar.gz
rails-7ef9849e3d51c1f4a37af368b770d8fdb41883cd.tar.bz2
rails-7ef9849e3d51c1f4a37af368b770d8fdb41883cd.zip
Migrations will raise an exception if there are multiple column definitions (same name).
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/migration/change_schema_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb
index f4d16cb093..7777508349 100644
--- a/activerecord/test/cases/migration/change_schema_test.rb
+++ b/activerecord/test/cases/migration/change_schema_test.rb
@@ -196,6 +196,17 @@ module ActiveRecord
assert_equal "you can't redefine the primary key column 'testing_id'. To define a custom primary key, pass { id: false } to create_table.", error.message
end
+ def test_create_table_raises_when_defining_existing_column
+ error = assert_raise(ArgumentError) do
+ connection.create_table :testings do |t|
+ t.column :testing_column, :string
+ t.column :testing_column, :integer
+ end
+ end
+
+ assert_equal "you can't define an already defined column 'testing_column'.", error.message
+ end
+
def test_create_table_with_timestamps_should_create_datetime_columns
connection.create_table table_name do |t|
t.timestamps