From fe8e23a5c5300f044e15717582f356d564a20198 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 31 May 2020 15:20:37 +0200 Subject: [PATCH] Autocorrect Performance/RegexpMatch offenses --- features/step_definitions/cucumber_rails_steps.rb | 2 +- features/support/cucumber_rails_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/cucumber_rails_steps.rb b/features/step_definitions/cucumber_rails_steps.rb index dc4f49a7..79403c15 100644 --- a/features/step_definitions/cucumber_rails_steps.rb +++ b/features/step_definitions/cucumber_rails_steps.rb @@ -26,7 +26,7 @@ new_content = [] content.each do |line| - next if line =~ /gem ["|']#{gem_name}["|'].*/ + next if /gem ["|']#{gem_name}["|'].*/.match?(line) new_content << line end diff --git a/features/support/cucumber_rails_helper.rb b/features/support/cucumber_rails_helper.rb index f05042f6..a1a75f27 100644 --- a/features/support/cucumber_rails_helper.rb +++ b/features/support/cucumber_rails_helper.rb @@ -25,7 +25,7 @@ def add_gem(name, *args) gem_regexp = /gem ["']#{name}["'].*$/ gemfile_content = File.read(expand_path('Gemfile')) - if gemfile_content =~ gem_regexp + if gemfile_content&.match?(gem_regexp) updated_gemfile_content = gemfile_content.gsub(gem_regexp, line) overwrite_file('Gemfile', updated_gemfile_content) else