Skip to content

Commit

Permalink
appease ChefStyle: Style/RegexpLiteral
Browse files Browse the repository at this point in the history
> Use %r around regular expression.

OK.

Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
robbkidd committed Jun 30, 2020
1 parent f21d138 commit 0a593f0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/supermarket/Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ group :red_green_refactor, halt_on_fail: true do

guard :rubocop, all_on_start: true do
watch(/.+\.rb$/)
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
watch(/(?:.+\/)?\.rubocop_todo\.yml$/) { |m| File.dirname(m[0]) }
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
watch(%r{(?:.+/)?\.rubocop_todo\.yml$}) { |m| File.dirname(m[0]) }
end
end
4 changes: 2 additions & 2 deletions src/supermarket/spec/features/branding_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def get_compiled_css(source_file_in_app_assets_stylesheets)
after { @b.delete }

it "should replace the logo" do
expected_svg = /logochef {\n background: url\(image-path\("branding\/SOMELOGO.svg"\)\)/
expected_png = /\.no-svg \.logochef {\n background: url\(image-path\(\"branding\/SOMELOGO.png\"\)\)/
expected_svg = %r{logochef \{\n background: url\(image-path\("branding/SOMELOGO.svg"\)\)}
expected_png = %r{\.no-svg \.logochef \{\n background: url\(image-path\(\"branding/SOMELOGO.png\"\)\)}
css = get_compiled_css("appheader.scss")
expect(css).to match(expected_svg)
expect(css).to match(expected_png)
Expand Down
12 changes: 6 additions & 6 deletions src/supermarket/spec/support/shared_examples/community_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
assign(:cookbook_count, 1)
assign(:user_count, 1)
render
expect(rendered).to match(/1 Cookbook<\/span>/)
expect(rendered).to match(/1 Chef<\/span>/)
expect(rendered).to match(%r{1 Cookbook</span>})
expect(rendered).to match(%r{1 Chef</span>})
end

it "displays cookbooks and chefs as plural if there is more than 1" do
assign(:cookbook_count, 2)
assign(:user_count, 2)
render
expect(rendered).to match(/2 Cookbooks<\/span>/)
expect(rendered).to match(/2 Chefs<\/span>/)
expect(rendered).to match(%r{2 Cookbooks</span>})
expect(rendered).to match(%r{2 Chefs</span>})
end

it "delimits numbers correctly if there are more than 999" do
assign(:cookbook_count, 1000)
assign(:user_count, 1000)
render
expect(rendered).to match(/1,000 Cookbooks<\/span>/)
expect(rendered).to match(/1,000 Chefs<\/span>/)
expect(rendered).to match(%r{1,000 Cookbooks</span>})
expect(rendered).to match(%r{1,000 Chefs</span>})
end
end
4 changes: 2 additions & 2 deletions src/supermarket/spec/views/pages/robots.text.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
it "configures Allow based on environment variables" do
ENV["ROBOTS_ALLOW"] = "/"
render
expect(rendered).to match(/Allow: \//)
expect(rendered).to match(%r{Allow: /})
end

it "configures Disallow based on environment variables" do
ENV["ROBOTS_DISALLOW"] = "/admin"
render
expect(rendered).to match(/Disallow: \/admin/)
expect(rendered).to match(%r{Disallow: /admin})
end
end

0 comments on commit 0a593f0

Please sign in to comment.