Skip to content

Commit f49661b

Browse files
committed
(CONT-807) Correct Style/RegexpLiteral
1 parent fa165f3 commit f49661b

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

lib/puppetlabs_spec_helper/module_spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def verify_contents(subject, title, expected_lines)
5656
components = module_path.split(File::PATH_SEPARATOR).map do |dir|
5757
next unless Dir.exist? dir
5858

59-
Dir.entries(dir).grep_v(%r{^\.}).map { |f| File.join(dir, f, 'spec', 'lib') }
59+
Dir.entries(dir).grep_v(/^\./).map { |f| File.join(dir, f, 'spec', 'lib') }
6060
end
6161
components.flatten.each do |d|
6262
$LOAD_PATH << d if FileTest.directory?(d) && !$LOAD_PATH.include?(d)

lib/puppetlabs_spec_helper/rake_tasks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
version = modinfo['version']
228228
elsif File.exist?('Modulefile')
229229
modfile = File.read('Modulefile')
230-
version = modfile.match(%r{\nversion +['"](.*)['"]})[1]
230+
version = modfile.match(/\nversion +['"](.*)['"]/)[1]
231231
else
232232
raise 'Could not find a metadata.json or Modulefile! Cannot compute dev version without one or the other!'
233233
end

lib/puppetlabs_spec_helper/tasks/check_symlinks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check(dir = Dir.pwd)
2626

2727
if child.symlink?
2828
results << child
29-
elsif child.directory? && child.basename.to_s !~ %r{^(\.git|\.?bundle)$}
29+
elsif child.directory? && child.basename.to_s !~ /^(\.git|\.?bundle)$/
3030
results.concat(check(child))
3131
end
3232
end

spec/acceptance/smoke_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
Open3.capture2e('rake', '--rakefile', 'spec/acceptance/fixtures/Rakefile', '-T')
1010
end
1111

12-
it { expect(output[0]).to match %r{spec_prep} }
12+
it { expect(output[0]).to match(/spec_prep/) }
1313
it { expect(output[1]).to be_success }
1414
end

spec/unit/puppetlabs_spec_helper/tasks/check_symlinks_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
it 'raises an error' do
5757
expect { task.execute }
58-
.to raise_error(%r{symlink\(s\) exist}i)
58+
.to raise_error(/symlink\(s\) exist/i)
5959
.and output(a_string_including(expected_output)).to_stdout
6060
end
6161
end

spec/unit/puppetlabs_spec_helper/tasks/check_test_file_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
expected_output = test_files.join("\n")
2323

2424
expect { task.execute }
25-
.to raise_error(%r{pp files present in tests folder})
25+
.to raise_error(/pp files present in tests folder/)
2626
.and output(a_string_including(expected_output)).to_stdout
2727
end
2828
end

spec/unit/puppetlabs_spec_helper/tasks/fixture_helpers_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@
118118
it 'raises an error' do
119119
expect(File).to receive(:exist?).with('.fixtures.yml').and_return true
120120
expect(YAML).to receive(:load_file).with('.fixtures.yml').and_raise(Psych::SyntaxError.new('/file', '123', '0', '0', 'spec message', 'spec context'))
121-
expect { helper.fixtures('forge_modules') }.to raise_error(RuntimeError, %r{malformed YAML})
121+
expect { helper.fixtures('forge_modules') }.to raise_error(RuntimeError, /malformed YAML/)
122122
end
123123
end
124124

125125
context 'when file contains no fixtures' do
126126
it 'raises an error' do
127127
allow(File).to receive(:exist?).with('.fixtures.yml').and_return true
128128
allow(YAML).to receive(:load_file).with('.fixtures.yml').and_return('some' => 'key')
129-
expect { helper.fixtures('forge_modules') }.to raise_error(RuntimeError, %r{No 'fixtures'})
129+
expect { helper.fixtures('forge_modules') }.to raise_error(RuntimeError, /No 'fixtures'/)
130130
end
131131
end
132132

spec/watchr.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def growl(message)
1010
growlnotify = `which growlnotify`.chomp
1111
title = 'Watchr Test Results'
1212
image = case message
13-
when %r{(\d+)\s+?(failure|error)}i
13+
when /(\d+)\s+?(failure|error)/i
1414
(Regexp.last_match(1).to_i == 0) ? '~/.watchr_images/passed.png' : '~/.watchr_images/failed.png'
1515
else
1616
'~/.watchr_images/unknown.png'
@@ -35,7 +35,7 @@ def run_spec_test(file)
3535
end
3636

3737
def filter_rspec(data)
38-
data.split("\n").grep(%r{^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending}).join("\n")
38+
data.split("\n").grep(/^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending/).join("\n")
3939
end
4040

4141
def run_all_tests

0 commit comments

Comments
 (0)