class Object
Public Instance Methods
add_to_cart(product) { || ... }
click to toggle source
# 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()
click to toggle source
# 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()
click to toggle source
# 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