diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-05-07 20:16:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-07 20:16:42 +0200 |
commit | 45095a817b29f3b4956abce5d059410d591b902a (patch) | |
tree | 5bf7fc2271ddc5d4ed511db35893c2049142831b /railties/test/generators/model_generator_test.rb | |
parent | af58740b8d943f90a18c3e7ceca9432775cfe192 (diff) | |
parent | b201474756a2ee493406ad0cb49f49c6873bdc28 (diff) | |
download | rails-45095a817b29f3b4956abce5d059410d591b902a.tar.gz rails-45095a817b29f3b4956abce5d059410d591b902a.tar.bz2 rails-45095a817b29f3b4956abce5d059410d591b902a.zip |
Merge pull request #29005 from kamipo/should_escape_meta_chars_in_regexp
Should escape meta characters in regexp
Diffstat (limited to 'railties/test/generators/model_generator_test.rb')
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 99490af3a9..f41969fc46 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -10,7 +10,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase run_generator assert_file "app/models/application_record.rb" do |record| assert_match(/class ApplicationRecord < ActiveRecord::Base/, record) - assert_match(/self.abstract_class = true/, record) + assert_match(/self\.abstract_class = true/, record) end end @@ -253,7 +253,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase def test_migration_with_timestamps run_generator - assert_migration "db/migrate/create_accounts.rb", /t.timestamps/ + assert_migration "db/migrate/create_accounts.rb", /t\.timestamps/ end def test_migration_timestamps_are_skipped @@ -261,7 +261,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_migration "db/migrate/create_accounts.rb" do |m| assert_method :change, m do |up| - assert_no_match(/t.timestamps/, up) + assert_no_match(/t\.timestamps/, up) end end end @@ -269,19 +269,19 @@ class ModelGeneratorTest < Rails::Generators::TestCase def test_migration_is_skipped_with_skip_option run_generator output = run_generator ["Account", "--skip"] - assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output + assert_match %r{skip\s+db/migrate/\d+_create_accounts\.rb}, output end def test_migration_is_ignored_as_identical_with_skip_option run_generator ["Account"] output = run_generator ["Account", "--skip"] - assert_match %r{identical\s+db/migrate/\d+_create_accounts.rb}, output + assert_match %r{identical\s+db/migrate/\d+_create_accounts\.rb}, output end def test_migration_is_skipped_on_skip_behavior run_generator output = run_generator ["Account"], behavior: :skip - assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output + assert_match %r{skip\s+db/migrate/\d+_create_accounts\.rb}, output end def test_migration_error_is_not_shown_on_revoke |