mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Tidy up checkout spec
This commit is contained in:
committed by
Maikel Linke
parent
94b90b4a73
commit
6b2c4de20f
@@ -23,42 +23,42 @@ feature "As a consumer I want to check out my cart", js: true do
|
||||
add_product_to_cart order, product
|
||||
end
|
||||
|
||||
it "does not not render the login form when logged in" do
|
||||
it "does not render the login form when logged in" do
|
||||
quick_login_as user
|
||||
visit checkout_path
|
||||
within "section[role='main']" do
|
||||
page.should_not have_content "Login"
|
||||
page.should have_checkout_details
|
||||
expect(page).to_not have_content "Login"
|
||||
expect(page).to have_checkout_details
|
||||
end
|
||||
end
|
||||
|
||||
it "renders the login buttons when logged out" do
|
||||
visit checkout_path
|
||||
within "section[role='main']" do
|
||||
page.should have_content "Login"
|
||||
expect(page).to have_content "Login"
|
||||
click_button "Login"
|
||||
end
|
||||
page.should have_login_modal
|
||||
expect(page).to have_login_modal
|
||||
end
|
||||
|
||||
it "populates user details once logged in" do
|
||||
visit checkout_path
|
||||
within("section[role='main']") { click_button "Login" }
|
||||
page.should have_login_modal
|
||||
expect(page).to have_login_modal
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
within(".login-modal") { click_button 'Login' }
|
||||
toggle_details
|
||||
|
||||
page.should have_field 'First Name', with: 'Foo'
|
||||
page.should have_field 'Last Name', with: 'Bar'
|
||||
expect(page).to have_field 'First Name', with: 'Foo'
|
||||
expect(page).to have_field 'Last Name', with: 'Bar'
|
||||
end
|
||||
|
||||
context "using the guest checkout" do
|
||||
it "allows user to checkout as guest" do
|
||||
visit checkout_path
|
||||
checkout_as_guest
|
||||
page.should have_checkout_details
|
||||
expect(page).to have_checkout_details
|
||||
end
|
||||
|
||||
it "asks the user to log in if they are using a registered email" do
|
||||
|
||||
Reference in New Issue
Block a user