From 45dd5cc40aa6baf97c9de3e21ace62d22c339811 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 12 Oct 2023 10:01:27 +1100 Subject: [PATCH] Style/SingleLineDoEndBlock: Prefer multiline do...end block --- spec/system/admin/tag_rules_spec.rb | 28 +++++++++++++++------ spec/system/admin/variant_overrides_spec.rb | 16 +++++++++--- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/spec/system/admin/tag_rules_spec.rb b/spec/system/admin/tag_rules_spec.rb index 9d698c6af4..7ccf1cf059 100644 --- a/spec/system/admin/tag_rules_spec.rb +++ b/spec/system/admin/tag_rules_spec.rb @@ -158,14 +158,18 @@ describe 'Tag Rules' do # DEFAULT FilterShippingMethods rule within ".default_rules #tr_0" do - within "li.tag-item", text: "local ✖" do find("a.remove-button").click end + within "li.tag-item", text: "local ✖" do + find("a.remove-button").click + end fill_in_tag "volunteers-only" expect(page).to have_content "not visible" end # FilterProducts rule within ".customer_tag #tr_1" do - within "li.tag-item", text: "member ✖" do find("a.remove-button").click end + within "li.tag-item", text: "member ✖" do + find("a.remove-button").click + end fill_in_tag "volunteers-only1" expect(page).to have_select2 "enterprise_tag_rules_attributes_1_preferred_matched_" \ "variants_visibility", selected: 'VISIBLE' @@ -176,7 +180,9 @@ describe 'Tag Rules' do # FilterPaymentMethods rule within ".customer_tag #tr_2" do - within "li.tag-item", text: "trusted ✖" do find("a.remove-button").click end + within "li.tag-item", text: "trusted ✖" do + find("a.remove-button").click + end fill_in_tag "volunteers-only2" expect(page).to have_select2 "enterprise_tag_rules_attributes_2_preferred_matched_" \ "payment_methods_visibility", selected: 'NOT VISIBLE' @@ -187,7 +193,9 @@ describe 'Tag Rules' do # FilterOrderCycles rule within ".customer_tag #tr_3" do - within "li.tag-item", text: "wholesale ✖" do find("a.remove-button").click end + within "li.tag-item", text: "wholesale ✖" do + find("a.remove-button").click + end fill_in_tag "volunteers-only3" expect(page).to have_select2 "enterprise_tag_rules_attributes_3_preferred_matched_" \ "order_cycles_visibility", selected: 'VISIBLE' @@ -198,7 +206,9 @@ describe 'Tag Rules' do # FilterShippingMethods rule within ".customer_tag #tr_4" do - within "li.tag-item", text: "local ✖" do find("a.remove-button").click end + within "li.tag-item", text: "local ✖" do + find("a.remove-button").click + end fill_in_tag "volunteers-only4" expect(page).to have_select2 "enterprise_tag_rules_attributes_4_preferred_matched_" \ "shipping_methods_visibility", selected: 'NOT VISIBLE' @@ -257,11 +267,15 @@ describe 'Tag Rules' do it "deletes both default and customer rules from the database" do expect do accept_alert do - within "#tr_1" do first("a.delete-tag-rule").click end + within "#tr_1" do + first("a.delete-tag-rule").click + end end expect(page).to have_no_selector "#tr_1" accept_alert do - within "#tr_0" do first("a.delete-tag-rule").click end + within "#tr_0" do + first("a.delete-tag-rule").click + end end expect(page).to have_no_selector "#tr_0" end.to change{ TagRule.count }.by(-2) diff --git a/spec/system/admin/variant_overrides_spec.rb b/spec/system/admin/variant_overrides_spec.rb index e392a65eeb..f34c7691b0 100644 --- a/spec/system/admin/variant_overrides_spec.rb +++ b/spec/system/admin/variant_overrides_spec.rb @@ -131,14 +131,18 @@ describe " toggle_columns "Hide" expect(page).to have_selector "tr#v_#{variant.id}" expect(page).to have_selector "tr#v_#{variant_related.id}" - within "tr#v_#{variant.id}" do click_button 'Hide' end + within "tr#v_#{variant.id}" do + click_button 'Hide' + end expect(page).to have_no_selector "tr#v_#{variant.id}" expect(page).to have_selector "tr#v_#{variant_related.id}" first("div#views-dropdown").click first("div#views-dropdown div.menu div.menu_item", text: "Hidden Products").click expect(page).to have_selector "tr#v_#{variant.id}" expect(page).to have_no_selector "tr#v_#{variant_related.id}" - within "tr#v_#{variant.id}" do click_button 'Add' end + within "tr#v_#{variant.id}" do + click_button 'Add' + end expect(page).to have_no_selector "tr#v_#{variant.id}" expect(page).to have_no_selector "tr#v_#{variant_related.id}" first("div#views-dropdown").click @@ -492,8 +496,12 @@ describe " expect(page).to have_table_row ['PRODUCER', 'PRODUCT', 'VARIANT', 'ADD', 'HIDE'] expect(page).to have_selector "table#new-products tr#v_#{variant1.id}" expect(page).to have_selector "table#new-products tr#v_#{variant2.id}" - within "table#new-products tr#v_#{variant1.id}" do click_button 'Add' end - within "table#new-products tr#v_#{variant2.id}" do click_button 'Hide' end + within "table#new-products tr#v_#{variant1.id}" do + click_button 'Add' + end + within "table#new-products tr#v_#{variant2.id}" do + click_button 'Hide' + end expect(page).to have_no_selector "table#new-products tr#v_#{variant1.id}" expect(page).to have_no_selector "table#new-products tr#v_#{variant2.id}" click_button "Back to my inventory"