From f304c6ad9c12d16a642977a5785fd3109996e24f Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:30:24 +0000 Subject: [PATCH 01/12] Updates/moves account_spec into system --- spec/{features => system}/consumer/account_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/account_spec.rb (99%) diff --git a/spec/features/consumer/account_spec.rb b/spec/system/consumer/account_spec.rb similarity index 99% rename from spec/features/consumer/account_spec.rb rename to spec/system/consumer/account_spec.rb index 7995895073..9fc18b37ba 100644 --- a/spec/features/consumer/account_spec.rb +++ b/spec/system/consumer/account_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe ' As a consumer From 83468710d3ec8611fd26add9a76c96f692af4607 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:31:24 +0000 Subject: [PATCH 02/12] Updates/moves footer_links_spec into system --- spec/{features => system}/consumer/footer_links_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/footer_links_spec.rb (97%) diff --git a/spec/features/consumer/footer_links_spec.rb b/spec/system/consumer/footer_links_spec.rb similarity index 97% rename from spec/features/consumer/footer_links_spec.rb rename to spec/system/consumer/footer_links_spec.rb index 7d6bee3df4..35620b1c57 100644 --- a/spec/features/consumer/footer_links_spec.rb +++ b/spec/system/consumer/footer_links_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe "Footer Links", js: true do describe "policy link" do From 2b02fd88265da2f152c64ee6a9c5b085ad21d8b1 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:32:07 +0000 Subject: [PATCH 03/12] Updates/moves groups_spec into system --- spec/{features => system}/consumer/groups_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/groups_spec.rb (99%) diff --git a/spec/features/consumer/groups_spec.rb b/spec/system/consumer/groups_spec.rb similarity index 99% rename from spec/features/consumer/groups_spec.rb rename to spec/system/consumer/groups_spec.rb index fba61c1185..210849da60 100644 --- a/spec/features/consumer/groups_spec.rb +++ b/spec/system/consumer/groups_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe 'Groups', js: true do include AuthenticationHelper From 2e313dd5e5e5bdd82414624499b55002e3caffcf Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:32:51 +0000 Subject: [PATCH 04/12] Updates/moves multilingual_spec into system --- spec/{features => system}/consumer/multilingual_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/multilingual_spec.rb (99%) diff --git a/spec/features/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb similarity index 99% rename from spec/features/consumer/multilingual_spec.rb rename to spec/system/consumer/multilingual_spec.rb index 31191a66d1..08718fabe8 100644 --- a/spec/features/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe 'Multilingual', js: true do include AuthenticationHelper From 0e8cc0f91694fb72c8765daa00edf78bd069a0c6 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:33:26 +0000 Subject: [PATCH 05/12] Updates/moves producers_spec into system --- spec/{features => system}/consumer/producers_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/producers_spec.rb (99%) diff --git a/spec/features/consumer/producers_spec.rb b/spec/system/consumer/producers_spec.rb similarity index 99% rename from spec/features/consumer/producers_spec.rb rename to spec/system/consumer/producers_spec.rb index eed98cfbca..23bb94ef34 100644 --- a/spec/features/consumer/producers_spec.rb +++ b/spec/system/consumer/producers_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe ' As a consumer From 345b9a181ca212ca4cb6cf273aa7c1960780c333 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 7 Dec 2021 18:34:04 +0000 Subject: [PATCH 06/12] Updates/moves shops_spec into system --- spec/{features => system}/consumer/shops_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spec/{features => system}/consumer/shops_spec.rb (99%) diff --git a/spec/features/consumer/shops_spec.rb b/spec/system/consumer/shops_spec.rb similarity index 99% rename from spec/features/consumer/shops_spec.rb rename to spec/system/consumer/shops_spec.rb index e311fd34f0..2122cf0a89 100644 --- a/spec/features/consumer/shops_spec.rb +++ b/spec/system/consumer/shops_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'spec_helper' +require 'system_helper' describe 'Shops', js: true do include AuthenticationHelper From 472cc114c0f4c145538946ffd2fccbaf73fe0ee5 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 11 Dec 2021 17:03:00 +0000 Subject: [PATCH 07/12] Fixes line break assertion in account_spec --- spec/system/consumer/account_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/account_spec.rb b/spec/system/consumer/account_spec.rb index 9fc18b37ba..c58e540db7 100644 --- a/spec/system/consumer/account_spec.rb +++ b/spec/system/consumer/account_spec.rb @@ -73,8 +73,8 @@ describe ' href: "#{distributor2.permalink}/shop", count: 1) expect(page).not_to have_content distributor_without_orders.name - expect(page).to have_content distributor1.name + "\n" + "Balance due" - expect(page).to have_content distributor_credit.name + "\nCredit" + expect(page).to have_content distributor1.name + " Balance due" + expect(page).to have_content distributor_credit.name + " Credit" # It reveals table of orders for distributors when clicked expand_active_table_node distributor1.name From eb315b42e4ef38d54e634a915856e0aff7428da9 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 11 Dec 2021 17:39:39 +0000 Subject: [PATCH 08/12] Updates cookie_helper to support Ferrum syntax --- spec/support/request/cookie_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/support/request/cookie_helper.rb b/spec/support/request/cookie_helper.rb index 197a757ff5..8fd274ca96 100644 --- a/spec/support/request/cookie_helper.rb +++ b/spec/support/request/cookie_helper.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true module CookieHelper - def cookie_named(name) - Capybara.current_session.driver.browser.manage.cookie_named(name) + def cookies_name + Capybara.current_session.driver.browser.cookies end def cookies - Capybara.current_session.driver.browser.manage.all_cookies + Capybara.current_session.driver.browser.cookies.all end end From 67d24373e695a062ff2beabe5022286cbfa36b3c Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 11 Dec 2021 17:40:56 +0000 Subject: [PATCH 09/12] Updates assertion to be Ferrum syntax compliant --- spec/system/consumer/multilingual_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb index 08718fabe8..5676823cb8 100644 --- a/spec/system/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -141,6 +141,6 @@ describe 'Multilingual', js: true do end def expect_menu_and_cookie_in_es - expect(cookie_named('locale')[:value]).to eq 'es' + expect(cookies_name['locale']).to have_attributes(:value=>"es") expect(page).to have_content 'TIENDAS' end From af548815aed46f5fb828e51a863f66d7618a808e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sat, 11 Dec 2021 17:48:09 +0000 Subject: [PATCH 10/12] Fixes rubocop warnings --- spec/system/consumer/multilingual_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb index 5676823cb8..796ac9c386 100644 --- a/spec/system/consumer/multilingual_spec.rb +++ b/spec/system/consumer/multilingual_spec.rb @@ -15,7 +15,8 @@ describe 'Multilingual', js: true do expect(Rails.application.config.i18n[:available_locales]).to eq ['en', 'es', 'pt'] end - it '18n-js fallsback to default language' do # in backend it doesn't until we change enforce_available_locales to `true` + it '18n-js fallsback to default language' do + # in backend it doesn't until we change enforce_available_locales to `true` visit root_path set_i18n_locale('it') expect(get_i18n_translation('label_shops')).to eq 'Shops' @@ -141,6 +142,6 @@ describe 'Multilingual', js: true do end def expect_menu_and_cookie_in_es - expect(cookies_name['locale']).to have_attributes(:value=>"es") + expect(cookies_name['locale']).to have_attributes(value: "es") expect(page).to have_content 'TIENDAS' end From 6aa6506df0a3395ed088f11a7ce6d77296a6b85b Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 13 Dec 2021 13:52:33 +1100 Subject: [PATCH 11/12] Style/StringConcatenation --- .rubocop_todo.yml | 1 - spec/system/consumer/account_spec.rb | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1b4d51f6e1..f648dfd145 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1648,7 +1648,6 @@ Style/StringConcatenation: - 'lib/spree/api/controller_setup.rb' - 'lib/spree/core/environment_extension.rb' - 'spec/controllers/user_confirmations_controller_spec.rb' - - 'spec/features/consumer/account_spec.rb' - 'spec/lib/open_food_network/order_grouper_spec.rb' - 'spec/models/spree/line_item_spec.rb' - 'spec/models/spree/product_spec.rb' diff --git a/spec/system/consumer/account_spec.rb b/spec/system/consumer/account_spec.rb index c58e540db7..f108006c6f 100644 --- a/spec/system/consumer/account_spec.rb +++ b/spec/system/consumer/account_spec.rb @@ -73,15 +73,15 @@ describe ' href: "#{distributor2.permalink}/shop", count: 1) expect(page).not_to have_content distributor_without_orders.name - expect(page).to have_content distributor1.name + " Balance due" - expect(page).to have_content distributor_credit.name + " Credit" + expect(page).to have_content "#{distributor1.name} Balance due" + expect(page).to have_content "#{distributor_credit.name} Credit" # It reveals table of orders for distributors when clicked expand_active_table_node distributor1.name - expect(page).to have_link "Order " + d1o1.number, href: "/orders/#{d1o1.number}" + expect(page).to have_link "Order #{d1o1.number}", href: "/orders/#{d1o1.number}" expand_active_table_node distributor2.name - expect(page).not_to have_content "Order " + d1o1.number.to_s + expect(page).not_to have_content "Order #{d1o1.number}" end context "when there is at least one changeable order" do From b7e0d46dadb249ec2f2618f10d51a231203f01e0 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 13 Dec 2021 13:56:52 +1100 Subject: [PATCH 12/12] Style Layout/LineLength --- .rubocop_todo.yml | 1 - spec/system/consumer/shops_spec.rb | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f648dfd145..da8a202961 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -161,7 +161,6 @@ Layout/LineLength: - 'spec/controllers/user_confirmations_controller_spec.rb' - 'spec/factories/stock_location_factory.rb' - 'spec/features/consumer/multilingual_spec.rb' - - 'spec/features/consumer/shops_spec.rb' - 'spec/helpers/enterprises_helper_spec.rb' - 'spec/helpers/injection_helper_spec.rb' - 'spec/helpers/order_cycles_helper_spec.rb' diff --git a/spec/system/consumer/shops_spec.rb b/spec/system/consumer/shops_spec.rb index 2122cf0a89..9379024c30 100644 --- a/spec/system/consumer/shops_spec.rb +++ b/spec/system/consumer/shops_spec.rb @@ -147,8 +147,12 @@ describe 'Shops', js: true do describe "property badges" do let!(:order_cycle) { - create(:simple_order_cycle, distributors: [distributor], - coordinator: create(:distributor_enterprise), variants: [product.variants.first]) + create( + :simple_order_cycle, + distributors: [distributor], + coordinator: create(:distributor_enterprise), + variants: [product.variants.first] + ) } let(:product) { create(:simple_product, supplier: producer) } @@ -176,8 +180,12 @@ describe 'Shops', js: true do let!(:product) { create(:simple_product, supplier: producer, taxons: [taxon]) } let!(:taxon) { create(:taxon, name: 'Fruit') } let!(:order_cycle) { - create(:simple_order_cycle, distributors: [distributor], - coordinator: create(:distributor_enterprise), variants: [product.variants.first]) + create( + :simple_order_cycle, + distributors: [distributor], + coordinator: create(:distributor_enterprise), + variants: [product.variants.first] + ) } it "shows hub producer modals" do