Top Level Namespace
- Includes:
- Warden::Test::Helpers
Defined Under Namespace
Modules: AuthenticationHelpers, Spree, SpreeDevTools
Instance Method Summary
collapse
Instance Method Details
#add_to_cart(product) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/spree_dev_tools/rspec/support/spree_cart.rb', line 17
def add_to_cart(product)
visit spree.product_path(product)
expect(page).to have_selector('form#add-to-cart-form')
expect(page).to have_selector(:button, id: 'add-to-cart-button', disabled: false)
yield if block_given?
click_button 'add-to-cart-button'
if Spree.version.to_f < 4.1
wait_for_condition do
expect(page).to have_content(Spree.t(:cart))
end
else
expect(page).to have_content(Spree.t(:added_to_cart))
visit spree.cart_path
end
end
|
#cart_container ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/spree_dev_tools/rspec/support/spree_cart.rb', line 9
def cart_container
if Spree.version.to_f < 4.1
find_all("#cart-detail tbody tr:first-child").first
else
find_all("#cart-detail .shopping-cart-item").first
end
end
|
#update_cart ⇒ Object
1
2
3
4
5
6
7
|
# File 'lib/spree_dev_tools/rspec/support/spree_cart.rb', line 1
def update_cart
if Spree.version.to_f < 4.1
click_button 'update-button'
else
page.execute_script("$('form#update-cart').submit()")
end
end
|