diff --git a/spec/rubocop/cli/auto_gen_config_spec.rb b/spec/rubocop/cli/auto_gen_config_spec.rb index 0691669b41e..dbe24fd500f 100644 --- a/spec/rubocop/cli/auto_gen_config_spec.rb +++ b/spec/rubocop/cli/auto_gen_config_spec.rb @@ -824,7 +824,7 @@ def a; end - 'example1.rb' - 'example2.rb' YAML - actual = File.read('.rubocop_todo.yml').lines.reject { |line| line =~ /^(#.*)?$/ } + actual = File.read('.rubocop_todo.yml').lines.grep_v(/^(#.*)?$/) expect(actual.join).to eq(expected) $stdout = StringIO.new @@ -842,7 +842,7 @@ def a; end Exclude: - 'example2.rb' YAML - actual = File.read('.rubocop_todo.yml').lines.reject { |line| line =~ /^(#.*)?$/ } + actual = File.read('.rubocop_todo.yml').lines.grep_v(/^(#.*)?$/) expect(actual.join).to eq(expected) expect(cli.run([])).to eq(0) diff --git a/spec/support/alignment_examples.rb b/spec/support/alignment_examples.rb index 64795f846e9..0366fed86f9 100644 --- a/spec/support/alignment_examples.rb +++ b/spec/support/alignment_examples.rb @@ -10,7 +10,7 @@ end annotated_source.split("\n\n").each do |chunk| chunk << "\n" unless chunk.end_with?("\n") - source = chunk.lines.reject { |line| /^ *\^/.match?(line) }.join + source = chunk.lines.grep_v(/^ *\^/).join name = source.gsub(/\n(?=[a-z ])/, ' ').gsub(/\s+/, ' ') it "registers an offense for mismatched #{name} and autocorrects" do