diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-23 22:36:05 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-23 22:36:05 -0300 |
commit | 5cde30298092cda13c5284aeda7721086d25e699 (patch) | |
tree | e86b5c17bd22dea8d268ec28dbdc5cd5cd4ad97e /activerecord/test | |
parent | 88b334ec696ffe1fa08b934780f4ab27030c5c76 (diff) | |
parent | 24eb440b561a5f3c87a2a6e4b35186c453051332 (diff) | |
download | rails-5cde30298092cda13c5284aeda7721086d25e699.tar.gz rails-5cde30298092cda13c5284aeda7721086d25e699.tar.bz2 rails-5cde30298092cda13c5284aeda7721086d25e699.zip |
Merge pull request #19030 from kamipo/extract_short_hand_column_methods
Extract the short-hand column methods into `ColumnMethods`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration/change_table_test.rb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/activerecord/test/cases/migration/change_table_test.rb b/activerecord/test/cases/migration/change_table_test.rb index 7010af5434..2ffe7a1b0d 100644 --- a/activerecord/test/cases/migration/change_table_test.rb +++ b/activerecord/test/cases/migration/change_table_test.rb @@ -13,7 +13,7 @@ module ActiveRecord end def with_change_table - yield ConnectionAdapters::Table.new(:delete_me, @connection) + yield ActiveRecord::Base.connection.update_table_definition(:delete_me, @connection) end def test_references_column_type_adds_id @@ -100,6 +100,13 @@ module ActiveRecord end end + def test_primary_key_creates_primary_key_column + with_change_table do |t| + @connection.expect :add_column, nil, [:delete_me, :id, :primary_key, primary_key: true, first: true] + t.primary_key :id, first: true + end + end + def test_integer_creates_integer_column with_change_table do |t| @connection.expect :add_column, nil, [:delete_me, :foo, :integer, {}] @@ -108,6 +115,14 @@ module ActiveRecord end end + def test_bigint_creates_bigint_column + with_change_table do |t| + @connection.expect :add_column, nil, [:delete_me, :foo, :bigint, {}] + @connection.expect :add_column, nil, [:delete_me, :bar, :bigint, {}] + t.bigint :foo, :bar + end + end + def test_string_creates_string_column with_change_table do |t| @connection.expect :add_column, nil, [:delete_me, :foo, :string, {}] @@ -116,6 +131,24 @@ module ActiveRecord end end + if current_adapter?(:PostgreSQLAdapter) + def test_json_creates_json_column + with_change_table do |t| + @connection.expect :add_column, nil, [:delete_me, :foo, :json, {}] + @connection.expect :add_column, nil, [:delete_me, :bar, :json, {}] + t.json :foo, :bar + end + end + + def test_xml_creates_xml_column + with_change_table do |t| + @connection.expect :add_column, nil, [:delete_me, :foo, :xml, {}] + @connection.expect :add_column, nil, [:delete_me, :bar, :xml, {}] + t.xml :foo, :bar + end + end + end + def test_column_creates_column with_change_table do |t| @connection.expect :add_column, nil, [:delete_me, :bar, :integer, {}] |