diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-02-28 18:19:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 18:19:33 -0500 |
commit | 77d3550f60a82bc316572026506df4123391d4b5 (patch) | |
tree | 786e633b1a900301a24133ed3eb72e8f5dc9a8d2 /activerecord/test | |
parent | 4b4d3f70eb372db6dca60b8a354f4b2cd179055d (diff) | |
parent | b01740f9088be49b49f7ed0ca7b73ebbde87bd97 (diff) | |
download | rails-77d3550f60a82bc316572026506df4123391d4b5.tar.gz rails-77d3550f60a82bc316572026506df4123391d4b5.tar.bz2 rails-77d3550f60a82bc316572026506df4123391d4b5.zip |
Merge pull request #25296 from kamipo/use_inspect_for_type_cast_for_schema
Use `inspect` in `type_cast_for_schema` for date/time and decimal values
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index 9584318e86..fccba4738f 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -422,11 +422,12 @@ class SchemaDumperDefaultsTest < ActiveRecord::TestCase setup do @connection = ActiveRecord::Base.connection - @connection.create_table :defaults, force: true do |t| + @connection.create_table :dump_defaults, force: true do |t| t.string :string_with_default, default: "Hello!" t.date :date_with_default, default: "2014-06-05" t.datetime :datetime_with_default, default: "2014-06-05 07:17:04" t.time :time_with_default, default: "07:17:04" + t.decimal :decimal_with_default, default: "1234567890.0123456789", precision: 20, scale: 10 end if current_adapter?(:PostgreSQLAdapter) @@ -438,17 +439,17 @@ class SchemaDumperDefaultsTest < ActiveRecord::TestCase end teardown do - return unless @connection - @connection.drop_table "defaults", if_exists: true + @connection.drop_table "dump_defaults", if_exists: true end def test_schema_dump_defaults_with_universally_supported_types - output = dump_table_schema("defaults") + output = dump_table_schema("dump_defaults") assert_match %r{t\.string\s+"string_with_default",.*?default: "Hello!"}, output - assert_match %r{t\.date\s+"date_with_default",\s+default: '2014-06-05'}, output - assert_match %r{t\.datetime\s+"datetime_with_default",\s+default: '2014-06-05 07:17:04'}, output - assert_match %r{t\.time\s+"time_with_default",\s+default: '2000-01-01 07:17:04'}, output + assert_match %r{t\.date\s+"date_with_default",\s+default: "2014-06-05"}, output + assert_match %r{t\.datetime\s+"datetime_with_default",\s+default: "2014-06-05 07:17:04"}, output + assert_match %r{t\.time\s+"time_with_default",\s+default: "2000-01-01 07:17:04"}, output + assert_match %r{t\.decimal\s+"decimal_with_default",\s+precision: 20,\s+scale: 10,\s+default: "1234567890.0123456789"}, output end def test_schema_dump_with_float_column_infinity_default |