aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2019-07-27 12:56:39 +0900
committerAkira Matsuda <ronnie@dio.jp>2019-07-27 13:06:49 +0900
commitd1ffe59ab5fd6e811833c127d43b32e87b5d7131 (patch)
treec866689e6b51b1f7eac9e49212d2938d56f6ecb2 /activerecord/test
parente9651deea4145f62224af56af027bfbb3e45e4cd (diff)
downloadrails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.tar.gz
rails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.tar.bz2
rails-d1ffe59ab5fd6e811833c127d43b32e87b5d7131.zip
Use match? where we don't need MatchData
We're already running Performance/RegexpMatch cop, but it seems like the cop is not always =~ justice
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb2
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 3525fa2ab8..21286be320 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -64,7 +64,7 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
Client.find(3).firm
ensure
sql_log = ActiveRecord::SQLCounter.log
- assert sql_log.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query: #{sql_log}"
+ assert sql_log.all? { |sql| !/order by/i.match?(sql) }, "ORDER BY was used in the query: #{sql_log}"
end
def test_belongs_to_with_primary_key
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index 3ef25c7027..9227f10c0e 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -41,7 +41,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
companies(:first_firm).account
ensure
sql_log = ActiveRecord::SQLCounter.log
- assert sql_log.all? { |sql| /order by/i !~ sql }, "ORDER BY was used in the query: #{sql_log}"
+ assert sql_log.all? { |sql| !/order by/i.match?(sql) }, "ORDER BY was used in the query: #{sql_log}"
end
def test_has_one_cache_nils