diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-12-20 15:20:38 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-01 20:09:55 +0900 |
commit | 7ff1fef72adcb654073349cad8ee9159fe8d6334 (patch) | |
tree | b164838c94696e11d07d69e11192819f4a7d8862 | |
parent | 87663ea14034a9a659a7dd617eb575df3fb9bb62 (diff) | |
download | rails-7ff1fef72adcb654073349cad8ee9159fe8d6334.tar.gz rails-7ff1fef72adcb654073349cad8ee9159fe8d6334.tar.bz2 rails-7ff1fef72adcb654073349cad8ee9159fe8d6334.zip |
Simplify `assert_no_match %r{colname.*limit:}` regex
In `test_schema_dump_includes_limit_constraint_for_integer_columns`,
unified `assert_match` and `assert_no_match` to simple regex.
-rw-r--r-- | activerecord/test/cases/schema_dumper_test.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb index cb8d449ba9..417c6f4832 100644 --- a/activerecord/test/cases/schema_dumper_test.rb +++ b/activerecord/test/cases/schema_dumper_test.rb @@ -116,32 +116,22 @@ class SchemaDumperTest < ActiveRecord::TestCase def test_schema_dump_includes_limit_constraint_for_integer_columns output = dump_all_table_schema([/^(?!integer_limits)/]) - assert_match %r{c_int_without_limit}, output + assert_match %r{"c_int_without_limit"(?!.*limit)}, output if current_adapter?(:PostgreSQLAdapter) - assert_no_match %r{c_int_without_limit.*limit:}, output - assert_match %r{c_int_1.*limit: 2}, output assert_match %r{c_int_2.*limit: 2}, output # int 3 is 4 bytes in postgresql - assert_match %r{c_int_3.*}, output - assert_no_match %r{c_int_3.*limit:}, output - - assert_match %r{c_int_4.*}, output - assert_no_match %r{c_int_4.*limit:}, output + assert_match %r{"c_int_3"(?!.*limit)}, output + assert_match %r{"c_int_4"(?!.*limit)}, output elsif current_adapter?(:Mysql2Adapter) - assert_match %r{c_int_without_limit"$}, output - assert_match %r{c_int_1.*limit: 1}, output assert_match %r{c_int_2.*limit: 2}, output assert_match %r{c_int_3.*limit: 3}, output - assert_match %r{c_int_4.*}, output - assert_no_match %r{c_int_4.*:limit}, output + assert_match %r{"c_int_4"(?!.*limit)}, output elsif current_adapter?(:SQLite3Adapter) - assert_no_match %r{c_int_without_limit.*limit:}, output - assert_match %r{c_int_1.*limit: 1}, output assert_match %r{c_int_2.*limit: 2}, output assert_match %r{c_int_3.*limit: 3}, output |