From cbda85c48db3faaef15a24a446a8afd7e46b0c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 18 Jul 2023 03:36:22 +0200 Subject: [PATCH] Add and apply Style/LineEndConcatenation rule We were already using it in most places. Note that enabling this rule means we've got to change a few lines in order to follow the LineEndStringConcatenationIndentation rule. In the link list tests, the easiest way to do so was to use heredoc instead, which IMHO improves readability over the previous version. --- .rubocop.yml | 3 +++ .../shared/link_list_component_spec.rb | 18 ++++++++++++------ spec/system/admin/budget_investments_spec.rb | 12 ++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 380ba4ace..a7c32aafe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -573,6 +573,9 @@ Style/IdenticalConditionalBranches: Style/IfWithBooleanLiteralBranches: Enabled: true +Style/LineEndConcatenation: + Enabled: true + Style/MapToHash: Enabled: true diff --git a/spec/components/shared/link_list_component_spec.rb b/spec/components/shared/link_list_component_spec.rb index f6ae9a3d4..962f07c30 100644 --- a/spec/components/shared/link_list_component_spec.rb +++ b/spec/components/shared/link_list_component_spec.rb @@ -18,9 +18,12 @@ describe Shared::LinkListComponent do ["Home", "/"], ["Info", "/info"], class: "menu" ) - expect(page).to be_rendered with: '\n" + expect(page).to be_rendered with: <<~HTML + + HTML end it "accepts anchor tags" do @@ -28,9 +31,12 @@ describe Shared::LinkListComponent do 'Home'.html_safe, ["Info", "/info"], class: "menu" ) - expect(page).to be_rendered with: '\n" + expect(page).to be_rendered with: <<~HTML + + HTML end it "accepts options for links" do diff --git a/spec/system/admin/budget_investments_spec.rb b/spec/system/admin/budget_investments_spec.rb index 43c0f16d0..ac7408eee 100644 --- a/spec/system/admin/budget_investments_spec.rb +++ b/spec/system/admin/budget_investments_spec.rb @@ -1797,8 +1797,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,title,supports,admin,valuator,geozone," + - "feasibility,price,valuation_finished,visible_to_valuators,selected,incompatible") + expect(cookie_value).to eq("id,title,supports,admin,valuator,geozone,feasibility,price," \ + "valuation_finished,visible_to_valuators,selected,incompatible") end scenario "Use column selector to display visible columns" do @@ -1847,8 +1847,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,supports,admin,geozone," + - "feasibility,valuation_finished,visible_to_valuators,selected,incompatible,author") + expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \ + "visible_to_valuators,selected,incompatible,author") visit admin_budget_budget_investments_path(budget) @@ -1856,8 +1856,8 @@ describe "Admin budget investments", :admin do columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" } cookie_value = columns_cookie[:value] - expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," + - "visible_to_valuators,selected,incompatible,author") + expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \ + "visible_to_valuators,selected,incompatible,author") end scenario "Select an investment when some columns are not displayed" do