mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Rename quick_login_as to login_as
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" }
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user