From 10b07aabd9bb5bb1a9fab70001c42e15df509826 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 27 Jul 2020 14:03:07 +0100 Subject: [PATCH] Rename quick_login_as to login_as --- spec/features/admin/bulk_order_management_spec.rb | 2 +- spec/features/admin/customers_spec.rb | 2 +- spec/features/admin/enterprise_fees_spec.rb | 2 +- spec/features/admin/enterprise_groups_spec.rb | 2 +- spec/features/admin/enterprise_relationships_spec.rb | 2 +- spec/features/admin/enterprise_user_spec.rb | 2 +- spec/features/admin/enterprises/images_spec.rb | 2 +- spec/features/admin/enterprises/index_spec.rb | 4 ++-- spec/features/admin/enterprises_spec.rb | 2 +- spec/features/admin/multilingual_spec.rb | 2 +- spec/features/admin/order_cycles/simple_spec.rb | 2 +- spec/features/admin/order_print_ticket_spec.rb | 2 +- spec/features/admin/order_spec.rb | 4 ++-- spec/features/admin/overview_spec.rb | 2 +- spec/features/admin/payment_method_spec.rb | 4 ++-- spec/features/admin/product_import_spec.rb | 4 ++-- spec/features/admin/products_spec.rb | 2 +- spec/features/admin/schedules_spec.rb | 2 +- spec/features/admin/shipping_methods_spec.rb | 2 +- spec/features/admin/subscriptions_spec.rb | 2 +- spec/features/admin/variant_overrides_spec.rb | 4 ++-- spec/features/consumer/account/cards_spec.rb | 2 +- spec/features/consumer/account/settings_spec.rb | 2 +- spec/features/consumer/multilingual_spec.rb | 4 ++-- spec/features/consumer/registration_spec.rb | 2 +- spec/features/consumer/shopping/cart_spec.rb | 2 +- spec/features/consumer/shopping/checkout_auth_spec.rb | 2 +- spec/features/consumer/shopping/checkout_spec.rb | 4 ++-- spec/features/consumer/shopping/orders_spec.rb | 2 +- spec/features/consumer/shopping/shopping_spec.rb | 4 ++-- spec/requests/checkout/stripe_connect_spec.rb | 2 +- spec/requests/checkout/stripe_sca_spec.rb | 2 +- spec/requests/embedded_shopfronts_headers_spec.rb | 2 +- spec/support/request/authentication_workflow.rb | 6 +++--- 34 files changed, 44 insertions(+), 44 deletions(-) diff --git a/spec/features/admin/bulk_order_management_spec.rb b/spec/features/admin/bulk_order_management_spec.rb index f4d40cd85f..a17d933f80 100644 --- a/spec/features/admin/bulk_order_management_spec.rb +++ b/spec/features/admin/bulk_order_management_spec.rb @@ -723,7 +723,7 @@ feature ' @enterprise_user.enterprise_roles.build(enterprise: s1).save @enterprise_user.enterprise_roles.build(enterprise: d1).save - quick_login_as @enterprise_user + login_as @enterprise_user end it "displays a Bulk Management Tab under the Orders item" do diff --git a/spec/features/admin/customers_spec.rb b/spec/features/admin/customers_spec.rb index 2260e2261a..49338715bb 100644 --- a/spec/features/admin/customers_spec.rb +++ b/spec/features/admin/customers_spec.rb @@ -18,7 +18,7 @@ feature 'Customers' do let!(:customer4) { create(:customer, enterprise: managed_distributor2) } before do - quick_login_as user + login_as user visit admin_customers_path end diff --git a/spec/features/admin/enterprise_fees_spec.rb b/spec/features/admin/enterprise_fees_spec.rb index a20ba2a419..a5732a67b4 100644 --- a/spec/features/admin/enterprise_fees_spec.rb +++ b/spec/features/admin/enterprise_fees_spec.rb @@ -113,7 +113,7 @@ feature ' before(:each) do enterprise_user.enterprise_roles.build(enterprise: distributor1).save enterprise_user.enterprise_roles.build(enterprise: distributor2).save - quick_login_as enterprise_user + login_as enterprise_user end it "creates enterprise fees" do diff --git a/spec/features/admin/enterprise_groups_spec.rb b/spec/features/admin/enterprise_groups_spec.rb index 029e3c3283..4cab98f0e7 100644 --- a/spec/features/admin/enterprise_groups_spec.rb +++ b/spec/features/admin/enterprise_groups_spec.rb @@ -112,7 +112,7 @@ feature ' let!(:group) { create(:enterprise_group, name: 'My Group', owner: user) } it "lets me access enterprise groups" do - quick_login_as user + login_as user visit spree.admin_dashboard_path click_link 'Groups' expect(page).to have_content 'My Group' diff --git a/spec/features/admin/enterprise_relationships_spec.rb b/spec/features/admin/enterprise_relationships_spec.rb index 23797478be..cb9bbaea1a 100644 --- a/spec/features/admin/enterprise_relationships_spec.rb +++ b/spec/features/admin/enterprise_relationships_spec.rb @@ -98,7 +98,7 @@ feature ' let!(:er2) { create(:enterprise_relationship, parent: d2, child: d1) } let!(:er3) { create(:enterprise_relationship, parent: d2, child: d3) } - before { quick_login_as enterprise_user } + before { login_as enterprise_user } scenario "enterprise user can only see relationships involving their enterprises" do visit admin_enterprise_relationships_path diff --git a/spec/features/admin/enterprise_user_spec.rb b/spec/features/admin/enterprise_user_spec.rb index 59fe2e07a5..9d6aa54535 100644 --- a/spec/features/admin/enterprise_user_spec.rb +++ b/spec/features/admin/enterprise_user_spec.rb @@ -34,7 +34,7 @@ feature ' describe "system management lockdown" do before do user.enterprise_roles.create!(enterprise: supplier1) - quick_login_as user + login_as user end scenario "should not be able to see system configuration" do diff --git a/spec/features/admin/enterprises/images_spec.rb b/spec/features/admin/enterprises/images_spec.rb index ba264b4ca0..302db2d291 100644 --- a/spec/features/admin/enterprises/images_spec.rb +++ b/spec/features/admin/enterprises/images_spec.rb @@ -11,7 +11,7 @@ feature "Managing enterprise images" do before do enterprise_user.enterprise_roles.build(enterprise: distributor).save! - quick_login_as enterprise_user + login_as enterprise_user visit edit_admin_enterprise_path(distributor) end diff --git a/spec/features/admin/enterprises/index_spec.rb b/spec/features/admin/enterprises/index_spec.rb index 56af1c66da..8afc7acb7e 100644 --- a/spec/features/admin/enterprises/index_spec.rb +++ b/spec/features/admin/enterprises/index_spec.rb @@ -111,7 +111,7 @@ feature 'Enterprises Index' do enterprise_manager.enterprise_roles.build(enterprise: supplier1).save enterprise_manager.enterprise_roles.build(enterprise: distributor1).save - quick_login_as enterprise_manager + login_as enterprise_manager end context "listing enterprises", js: true do @@ -166,7 +166,7 @@ feature 'Enterprises Index' do let!(:owned_distributor) { create(:distributor_enterprise, name: 'Owned Distributor', owner: user) } before do - quick_login_as user + login_as user end context "listing enterprises", js: true do diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index 37b8fefd35..dc5d1e5458 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -291,7 +291,7 @@ feature ' enterprise_user.enterprise_roles.build(enterprise: supplier1).save enterprise_user.enterprise_roles.build(enterprise: distributor1).save - quick_login_as enterprise_user + login_as enterprise_user end context "when I have reached my enterprise ownership limit" do diff --git a/spec/features/admin/multilingual_spec.rb b/spec/features/admin/multilingual_spec.rb index 90d21d1ecd..33ad4d1d03 100644 --- a/spec/features/admin/multilingual_spec.rb +++ b/spec/features/admin/multilingual_spec.rb @@ -8,7 +8,7 @@ feature 'Multilingual', js: true do background do admin_user.spree_roles << admin_role - quick_login_as admin_user + login_as admin_user visit spree.admin_dashboard_path end diff --git a/spec/features/admin/order_cycles/simple_spec.rb b/spec/features/admin/order_cycles/simple_spec.rb index ff05885895..02d49be349 100644 --- a/spec/features/admin/order_cycles/simple_spec.rb +++ b/spec/features/admin/order_cycles/simple_spec.rb @@ -153,7 +153,7 @@ feature ' @new_user.enterprise_roles.build(enterprise: distributor_managed).save @new_user.enterprise_roles.build(enterprise: other_distributor_managed).save - quick_login_as @new_user + login_as @new_user end scenario "viewing a list of order cycles I am coordinating" do diff --git a/spec/features/admin/order_print_ticket_spec.rb b/spec/features/admin/order_print_ticket_spec.rb index 1718e62436..08616352dd 100644 --- a/spec/features/admin/order_print_ticket_spec.rb +++ b/spec/features/admin/order_print_ticket_spec.rb @@ -27,7 +27,7 @@ feature ' @enterprise_user = create(:user) @enterprise_user.enterprise_roles.build(enterprise: distributor).save - quick_login_as @enterprise_user + login_as @enterprise_user Spree::Config[:enable_receipt_printing?] = true end diff --git a/spec/features/admin/order_spec.rb b/spec/features/admin/order_spec.rb index 33a1cc9ae2..be70b5392f 100644 --- a/spec/features/admin/order_spec.rb +++ b/spec/features/admin/order_spec.rb @@ -144,7 +144,7 @@ feature ' order.shipping_method.update_attribute :require_ship_address, true # When I create a new order - quick_login_as user + login_as user new_order_with_distribution(distributor, order_cycle) targetted_select2_search product.name, from: '#add_variant_id', dropdown_css: '.select2-drop' find('button.add_variant').click @@ -187,7 +187,7 @@ feature ' @enterprise_user.enterprise_roles.build(enterprise: coordinator1).save @enterprise_user.enterprise_roles.build(enterprise: distributor1).save - quick_login_as @enterprise_user + login_as @enterprise_user end feature "viewing the edit page" do diff --git a/spec/features/admin/overview_spec.rb b/spec/features/admin/overview_spec.rb index 460d4cf433..79b4ebf55c 100644 --- a/spec/features/admin/overview_spec.rb +++ b/spec/features/admin/overview_spec.rb @@ -12,7 +12,7 @@ feature ' before do @enterprise_user = create(:user) allow_any_instance_of(Spree::Admin::OverviewController).to receive(:spree_current_user).and_return @enterprise_user - quick_login_as @enterprise_user + login_as @enterprise_user end context "with an enterprise" do diff --git a/spec/features/admin/payment_method_spec.rb b/spec/features/admin/payment_method_spec.rb index c5cdc86767..f6b8f798c2 100644 --- a/spec/features/admin/payment_method_spec.rb +++ b/spec/features/admin/payment_method_spec.rb @@ -45,7 +45,7 @@ feature ' end it "communicates the status of the stripe connection to the user" do - quick_login_as user + login_as user visit spree.new_admin_payment_method_path select2_select "Stripe", from: "payment_method_type" @@ -136,7 +136,7 @@ feature ' before(:each) do enterprise_user.enterprise_roles.build(enterprise: distributor1).save enterprise_user.enterprise_roles.build(enterprise: distributor2).save - quick_login_as enterprise_user + login_as enterprise_user end it "I can get to the new enterprise page" do diff --git a/spec/features/admin/product_import_spec.rb b/spec/features/admin/product_import_spec.rb index eda7695086..85669fa9ed 100644 --- a/spec/features/admin/product_import_spec.rb +++ b/spec/features/admin/product_import_spec.rb @@ -408,7 +408,7 @@ feature "Product Import", js: true do end File.write('/tmp/test.csv', csv_data) - quick_login_as user + login_as user visit main_app.admin_product_import_path attach_file 'file', '/tmp/test.csv' @@ -432,7 +432,7 @@ feature "Product Import", js: true do let(:tmp_csv_path) { "/tmp/test.csv" } before do - quick_login_as admin + login_as admin visit main_app.admin_product_import_path end diff --git a/spec/features/admin/products_spec.rb b/spec/features/admin/products_spec.rb index bba42f7218..61f1a45c6e 100644 --- a/spec/features/admin/products_spec.rb +++ b/spec/features/admin/products_spec.rb @@ -104,7 +104,7 @@ feature ' create(:enterprise_relationship, parent: @supplier_permitted, child: @supplier2, permissions_list: [:manage_products]) - quick_login_as @new_user + login_as @new_user end context "products do not require a tax category" do diff --git a/spec/features/admin/schedules_spec.rb b/spec/features/admin/schedules_spec.rb index f017596e53..1d70d1bf34 100644 --- a/spec/features/admin/schedules_spec.rb +++ b/spec/features/admin/schedules_spec.rb @@ -16,7 +16,7 @@ feature 'Schedules', js: true do let!(:oc5) { create(:simple_order_cycle, coordinator: managed_enterprise2, name: 'oc5') } let!(:weekly_schedule) { create(:schedule, name: 'Weekly', order_cycles: [oc1, oc2, oc3, oc4]) } - before { quick_login_as user } + before { login_as user } describe "Adding a new Schedule" do it "immediately shows the schedule in the order cycle list once created" do diff --git a/spec/features/admin/shipping_methods_spec.rb b/spec/features/admin/shipping_methods_spec.rb index 8ab7cb1bc0..fb57f2f898 100644 --- a/spec/features/admin/shipping_methods_spec.rb +++ b/spec/features/admin/shipping_methods_spec.rb @@ -94,7 +94,7 @@ feature 'shipping methods' do before(:each) do enterprise_user.enterprise_roles.build(enterprise: distributor1).save enterprise_user.enterprise_roles.build(enterprise: distributor2).save - quick_login_as enterprise_user + login_as enterprise_user end it "creating a shipping method" do diff --git a/spec/features/admin/subscriptions_spec.rb b/spec/features/admin/subscriptions_spec.rb index 358ffb4671..604126cf45 100644 --- a/spec/features/admin/subscriptions_spec.rb +++ b/spec/features/admin/subscriptions_spec.rb @@ -11,7 +11,7 @@ feature 'Subscriptions' do let!(:shop2) { create(:distributor_enterprise, owner: user, enable_subscriptions: true) } let!(:shop_unmanaged) { create(:distributor_enterprise, enable_subscriptions: true) } - before { quick_login_as user } + before { login_as user } context 'listing subscriptions' do let!(:subscription) { create(:subscription, shop: shop, with_items: true, with_proxy_orders: true) } diff --git a/spec/features/admin/variant_overrides_spec.rb b/spec/features/admin/variant_overrides_spec.rb index ea5744349e..d540a3518e 100644 --- a/spec/features/admin/variant_overrides_spec.rb +++ b/spec/features/admin/variant_overrides_spec.rb @@ -26,7 +26,7 @@ feature " } let(:user) { create(:user, enterprises: [hub, producer_managed]) } - before { quick_login_as user } + before { login_as user } describe "selecting a hub" do let!(:er1) { @@ -471,7 +471,7 @@ feature " last_variant = inventory_items.last.variant first_variant.product.update!(name: "A First Product") last_variant.product.update!(name: "Z Last Product") - quick_login_as supplier.users.first + login_as supplier.users.first visit admin_inventory_path expect(page).to have_text first_variant.name diff --git a/spec/features/consumer/account/cards_spec.rb b/spec/features/consumer/account/cards_spec.rb index 2b2008b049..c0a5da2150 100644 --- a/spec/features/consumer/account/cards_spec.rb +++ b/spec/features/consumer/account/cards_spec.rb @@ -9,7 +9,7 @@ feature "Credit Cards", js: true do let!(:non_default_card) { create(:credit_card, user_id: user.id, gateway_customer_profile_id: 'cus_FDTG') } before do - quick_login_as user + login_as user allow(Stripe).to receive(:api_key) { "sk_test_xxxx" } allow(Stripe).to receive(:publishable_key) { "some_token" } diff --git a/spec/features/consumer/account/settings_spec.rb b/spec/features/consumer/account/settings_spec.rb index 2edc45cab1..16eeade5a1 100644 --- a/spec/features/consumer/account/settings_spec.rb +++ b/spec/features/consumer/account/settings_spec.rb @@ -14,7 +14,7 @@ feature "Account Settings", js: true do before do setup_email - quick_login_as user + login_as user visit "/account" click_link I18n.t('spree.users.show.tabs.settings') expect(page).to have_content I18n.t('spree.users.form.account_settings') diff --git a/spec/features/consumer/multilingual_spec.rb b/spec/features/consumer/multilingual_spec.rb index 3e8a19f4d0..a62a1b6ba3 100644 --- a/spec/features/consumer/multilingual_spec.rb +++ b/spec/features/consumer/multilingual_spec.rb @@ -77,14 +77,14 @@ feature 'Multilingual', js: true do expect_menu_and_cookie_in_es expect(user.locale).to be_nil - quick_login_as user + login_as user visit root_path expect_menu_and_cookie_in_es end it 'updates user locale and stays in cookie after logout' do - quick_login_as user + login_as user visit root_path(locale: 'es') user.reload diff --git a/spec/features/consumer/registration_spec.rb b/spec/features/consumer/registration_spec.rb index 0e9f1b221c..ddb93298c7 100644 --- a/spec/features/consumer/registration_spec.rb +++ b/spec/features/consumer/registration_spec.rb @@ -154,7 +154,7 @@ feature "Registration", js: true do let!(:user2) { create(:user) } before do - quick_login_as user2 + login_as user2 end context "if accepting Terms of Service is not required" do diff --git a/spec/features/consumer/shopping/cart_spec.rb b/spec/features/consumer/shopping/cart_spec.rb index 0bc4523a24..7d156ef596 100644 --- a/spec/features/consumer/shopping/cart_spec.rb +++ b/spec/features/consumer/shopping/cart_spec.rb @@ -262,7 +262,7 @@ feature "full-page cart", js: true do order.distributor.allow_order_changes = true order.distributor.save add_product_to_cart order, product_with_tax - quick_login_as user + login_as user visit main_app.cart_path end diff --git a/spec/features/consumer/shopping/checkout_auth_spec.rb b/spec/features/consumer/shopping/checkout_auth_spec.rb index a4d9d8c1c3..4631e636ce 100644 --- a/spec/features/consumer/shopping/checkout_auth_spec.rb +++ b/spec/features/consumer/shopping/checkout_auth_spec.rb @@ -24,7 +24,7 @@ feature "As a consumer I want to check out my cart", js: true do end it "does not render the login form when logged in" do - quick_login_as user + login_as user visit checkout_path within "section[role='main']" do expect(page).to have_no_content "Login" diff --git a/spec/features/consumer/shopping/checkout_spec.rb b/spec/features/consumer/shopping/checkout_spec.rb index 342c699a43..7f665e6351 100644 --- a/spec/features/consumer/shopping/checkout_spec.rb +++ b/spec/features/consumer/shopping/checkout_spec.rb @@ -65,7 +65,7 @@ feature "As a consumer I want to check out my cart", js: true do let(:user) { create(:user) } before do - quick_login_as(user) + login_as(user) end context "with details filled out" do @@ -292,7 +292,7 @@ feature "As a consumer I want to check out my cart", js: true do expect(page).to have_content "Donkeys" expect(page).not_to have_content "Local" - quick_login_as(user) + login_as(user) visit checkout_path # Default rule in still effect, disallows access to 'Local' diff --git a/spec/features/consumer/shopping/orders_spec.rb b/spec/features/consumer/shopping/orders_spec.rb index 4f2a379c12..1d5221e257 100644 --- a/spec/features/consumer/shopping/orders_spec.rb +++ b/spec/features/consumer/shopping/orders_spec.rb @@ -109,7 +109,7 @@ feature "Order Management", js: true do order.save order.reload - quick_login_as user + login_as user end it 'shows the name of the shipping method' do diff --git a/spec/features/consumer/shopping/shopping_spec.rb b/spec/features/consumer/shopping/shopping_spec.rb index b28dcbefec..9dd9ebbc65 100644 --- a/spec/features/consumer/shopping/shopping_spec.rb +++ b/spec/features/consumer/shopping/shopping_spec.rb @@ -485,7 +485,7 @@ feature "As a consumer I want to shop with a distributor", js: true do let(:user) { create(:user, bill_address: address, ship_address: address) } before do - quick_login_as user + login_as user end context "as non-customer" do @@ -533,7 +533,7 @@ feature "As a consumer I want to shop with a distributor", js: true do let!(:returning_user) { create(:user, email: unregistered_customer.email) } before do - quick_login_as returning_user + login_as returning_user end it "shows the products without customer only message" do diff --git a/spec/requests/checkout/stripe_connect_spec.rb b/spec/requests/checkout/stripe_connect_spec.rb index 000b2250a8..75ca23c8c4 100644 --- a/spec/requests/checkout/stripe_connect_spec.rb +++ b/spec/requests/checkout/stripe_connect_spec.rb @@ -244,7 +244,7 @@ describe "checking out an order with a Stripe Connect payment method", type: :re before do params[:order][:existing_card_id] = credit_card.id - quick_login_as(order.user) + login_as(order.user) # Requests a token stub_request(:post, "https://api.stripe.com/v1/tokens") diff --git a/spec/requests/checkout/stripe_sca_spec.rb b/spec/requests/checkout/stripe_sca_spec.rb index d2734f66d4..95a5b29554 100644 --- a/spec/requests/checkout/stripe_sca_spec.rb +++ b/spec/requests/checkout/stripe_sca_spec.rb @@ -289,7 +289,7 @@ describe "checking out an order with a Stripe SCA payment method", type: :reques before do params[:order][:existing_card_id] = credit_card.id - quick_login_as(order.user) + login_as(order.user) end context "and the payment intent and payment method requests are accepted" do diff --git a/spec/requests/embedded_shopfronts_headers_spec.rb b/spec/requests/embedded_shopfronts_headers_spec.rb index 9e1dd4be4d..f04de87b86 100644 --- a/spec/requests/embedded_shopfronts_headers_spec.rb +++ b/spec/requests/embedded_shopfronts_headers_spec.rb @@ -7,7 +7,7 @@ describe "setting response headers for embedded shopfronts", type: :request do let(:user) { enterprise.owner } before do - quick_login_as(user) + login_as(user) end context "with embedded shopfront disabled" do diff --git a/spec/support/request/authentication_workflow.rb b/spec/support/request/authentication_workflow.rb index c8d2940a01..a10c858508 100644 --- a/spec/support/request/authentication_workflow.rb +++ b/spec/support/request/authentication_workflow.rb @@ -1,7 +1,7 @@ module AuthenticationWorkflow include Warden::Test::Helpers - def quick_login_as(user) + def login_as(user) login_as user end @@ -15,7 +15,7 @@ module AuthenticationWorkflow login: 'admin@ofn.org') admin_user.spree_roles << admin_role - quick_login_as admin_user + login_as admin_user admin_user end @@ -29,7 +29,7 @@ module AuthenticationWorkflow end def login_to_admin_as(user) - quick_login_as user + login_as user visit spree.admin_dashboard_path end