diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1b4d51f6e1..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' @@ -1648,7 +1647,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/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 diff --git a/spec/features/consumer/account_spec.rb b/spec/system/consumer/account_spec.rb similarity index 93% rename from spec/features/consumer/account_spec.rb rename to spec/system/consumer/account_spec.rb index 7995895073..f108006c6f 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 @@ -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 + "\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 - 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 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 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 diff --git a/spec/features/consumer/multilingual_spec.rb b/spec/system/consumer/multilingual_spec.rb similarity index 95% rename from spec/features/consumer/multilingual_spec.rb rename to spec/system/consumer/multilingual_spec.rb index 31191a66d1..796ac9c386 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 @@ -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(cookie_named('locale')[:value]).to eq 'es' + expect(cookies_name['locale']).to have_attributes(value: "es") expect(page).to have_content 'TIENDAS' end 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 diff --git a/spec/features/consumer/shops_spec.rb b/spec/system/consumer/shops_spec.rb similarity index 94% rename from spec/features/consumer/shops_spec.rb rename to spec/system/consumer/shops_spec.rb index e311fd34f0..9379024c30 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 @@ -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