spree_frontend 3.3.0.rc1 → 3.3.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend.js +0 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +0 -2
  4. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +1 -1
  5. data/app/controllers/spree/orders_controller.rb +17 -15
  6. data/app/helpers/spree/frontend_helper.rb +0 -5
  7. data/app/helpers/spree/store_helper.rb +5 -0
  8. data/app/views/spree/address/_form.html.erb +12 -10
  9. data/app/views/spree/checkout/edit.html.erb +1 -5
  10. data/app/views/spree/products/_product.html.erb +22 -0
  11. data/app/views/spree/shared/_header.html.erb +1 -1
  12. data/app/views/spree/shared/_order_details.html.erb +1 -3
  13. data/app/views/spree/{payments → shared}/_payment.html.erb +2 -0
  14. data/app/views/spree/shared/_products.html.erb +1 -25
  15. data/app/views/spree/shared/_search.html.erb +1 -2
  16. data/config/routes.rb +4 -0
  17. data/lib/spree/frontend/engine.rb +0 -1
  18. data/spree_frontend.gemspec +1 -2
  19. metadata +10 -139
  20. data/app/views/spree/store/cart_link.html.erb +0 -1
  21. data/config/initializers/spree.rb +0 -2
  22. data/lib/tasks/rake_util.rb +0 -19
  23. data/lib/tasks/taxon.rake +0 -14
  24. data/spec/controllers/controller_extension_spec.rb +0 -126
  25. data/spec/controllers/controller_helpers_spec.rb +0 -122
  26. data/spec/controllers/spree/checkout_controller_spec.rb +0 -547
  27. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
  28. data/spec/controllers/spree/content_controller_spec.rb +0 -12
  29. data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
  30. data/spec/controllers/spree/home_controller_spec.rb +0 -47
  31. data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -96
  32. data/spec/controllers/spree/orders_controller_spec.rb +0 -134
  33. data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -31
  34. data/spec/controllers/spree/products_controller_spec.rb +0 -87
  35. data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
  36. data/spec/features/address_spec.rb +0 -93
  37. data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
  38. data/spec/features/caching/products_spec.rb +0 -59
  39. data/spec/features/caching/taxons_spec.rb +0 -22
  40. data/spec/features/cart_spec.rb +0 -132
  41. data/spec/features/checkout_spec.rb +0 -723
  42. data/spec/features/checkout_unshippable_spec.rb +0 -34
  43. data/spec/features/coupon_code_spec.rb +0 -88
  44. data/spec/features/currency_spec.rb +0 -18
  45. data/spec/features/delivery_spec.rb +0 -64
  46. data/spec/features/free_shipping_promotions_spec.rb +0 -59
  47. data/spec/features/locale_spec.rb +0 -60
  48. data/spec/features/microdata_spec.rb +0 -0
  49. data/spec/features/order_spec.rb +0 -107
  50. data/spec/features/page_promotions_spec.rb +0 -36
  51. data/spec/features/products_spec.rb +0 -345
  52. data/spec/features/taxons_spec.rb +0 -147
  53. data/spec/features/template_rendering_spec.rb +0 -19
  54. data/spec/fixtures/thinking-cat.jpg +0 -0
  55. data/spec/helpers/frontend_helper_spec.rb +0 -57
  56. data/spec/helpers/taxons_helper_spec.rb +0 -17
  57. data/spec/spec_helper.rb +0 -128
  58. data/spec/support/shared_contexts/checkout_setup.rb +0 -10
  59. data/spec/support/shared_contexts/custom_products.rb +0 -25
  60. data/spec/support/shared_contexts/product_prototypes.rb +0 -30
  61. data/spec/views/spree/checkout/_summary_spec.rb +0 -11
  62. data/vendor/assets/javascripts/jquery.validate/additional-methods.min.js +0 -12
  63. data/vendor/assets/javascripts/jquery.validate/jquery.validate.min.js +0 -12
  64. data/vendor/assets/javascripts/jquery.validate/localization/messages_ar.js +0 -25
  65. data/vendor/assets/javascripts/jquery.validate/localization/messages_bg.js +0 -25
  66. data/vendor/assets/javascripts/jquery.validate/localization/messages_ca.js +0 -25
  67. data/vendor/assets/javascripts/jquery.validate/localization/messages_cs.js +0 -25
  68. data/vendor/assets/javascripts/jquery.validate/localization/messages_da.js +0 -22
  69. data/vendor/assets/javascripts/jquery.validate/localization/messages_de.js +0 -22
  70. data/vendor/assets/javascripts/jquery.validate/localization/messages_el.js +0 -25
  71. data/vendor/assets/javascripts/jquery.validate/localization/messages_es.js +0 -25
  72. data/vendor/assets/javascripts/jquery.validate/localization/messages_et.js +0 -23
  73. data/vendor/assets/javascripts/jquery.validate/localization/messages_eu.js +0 -25
  74. data/vendor/assets/javascripts/jquery.validate/localization/messages_fa.js +0 -25
  75. data/vendor/assets/javascripts/jquery.validate/localization/messages_fi.js +0 -23
  76. data/vendor/assets/javascripts/jquery.validate/localization/messages_fr.js +0 -47
  77. data/vendor/assets/javascripts/jquery.validate/localization/messages_ge.js +0 -23
  78. data/vendor/assets/javascripts/jquery.validate/localization/messages_he.js +0 -25
  79. data/vendor/assets/javascripts/jquery.validate/localization/messages_hr.js +0 -25
  80. data/vendor/assets/javascripts/jquery.validate/localization/messages_hu.js +0 -24
  81. data/vendor/assets/javascripts/jquery.validate/localization/messages_it.js +0 -25
  82. data/vendor/assets/javascripts/jquery.validate/localization/messages_ja.js +0 -25
  83. data/vendor/assets/javascripts/jquery.validate/localization/messages_ka.js +0 -25
  84. data/vendor/assets/javascripts/jquery.validate/localization/messages_kk.js +0 -25
  85. data/vendor/assets/javascripts/jquery.validate/localization/messages_ko.js +0 -25
  86. data/vendor/assets/javascripts/jquery.validate/localization/messages_lt.js +0 -25
  87. data/vendor/assets/javascripts/jquery.validate/localization/messages_lv.js +0 -25
  88. data/vendor/assets/javascripts/jquery.validate/localization/messages_ms.js +0 -25
  89. data/vendor/assets/javascripts/jquery.validate/localization/messages_nl.js +0 -35
  90. data/vendor/assets/javascripts/jquery.validate/localization/messages_no.js +0 -25
  91. data/vendor/assets/javascripts/jquery.validate/localization/messages_pl.js +0 -25
  92. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptbr.js +0 -24
  93. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptpt.js +0 -24
  94. data/vendor/assets/javascripts/jquery.validate/localization/messages_ro.js +0 -25
  95. data/vendor/assets/javascripts/jquery.validate/localization/messages_ru.js +0 -25
  96. data/vendor/assets/javascripts/jquery.validate/localization/messages_se.js +0 -23
  97. data/vendor/assets/javascripts/jquery.validate/localization/messages_si.js +0 -25
  98. data/vendor/assets/javascripts/jquery.validate/localization/messages_sk.js +0 -22
  99. data/vendor/assets/javascripts/jquery.validate/localization/messages_sl.js +0 -25
  100. data/vendor/assets/javascripts/jquery.validate/localization/messages_sr.js +0 -25
  101. data/vendor/assets/javascripts/jquery.validate/localization/messages_sv.js +0 -23
  102. data/vendor/assets/javascripts/jquery.validate/localization/messages_th.js +0 -25
  103. data/vendor/assets/javascripts/jquery.validate/localization/messages_tr.js +0 -25
  104. data/vendor/assets/javascripts/jquery.validate/localization/messages_tw.js +0 -24
  105. data/vendor/assets/javascripts/jquery.validate/localization/messages_uk.js +0 -25
  106. data/vendor/assets/javascripts/jquery.validate/localization/messages_vi.js +0 -25
  107. data/vendor/assets/javascripts/jquery.validate/localization/messages_zh.js +0 -25
  108. data/vendor/assets/javascripts/jquery.validate/localization/messages_zhtw.js +0 -26
  109. data/vendor/assets/javascripts/jquery.validate/localization/methods_de.js +0 -12
  110. data/vendor/assets/javascripts/jquery.validate/localization/methods_nl.js +0 -9
  111. data/vendor/assets/javascripts/jquery.validate/localization/methods_pt.js +0 -9
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::TaxonsController, type: :controller do
4
- it "should provide the current user to the searcher class" do
5
- taxon = create(:taxon, permalink: "test")
6
- user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
7
- allow(controller).to receive_messages spree_current_user: user
8
- expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
9
- spree_get :show, id: taxon.permalink
10
- expect(response.status).to eq(200)
11
- end
12
- end
@@ -1,93 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Address", type: :feature, inaccessible: true do
4
- let!(:product) { create(:product, name: "RoR Mug") }
5
- let!(:order) { create(:order_with_totals, state: 'cart') }
6
-
7
- stub_authorization!
8
-
9
- after do
10
- Capybara.ignore_hidden_elements = true
11
- end
12
-
13
- before do
14
- Capybara.ignore_hidden_elements = false
15
-
16
- visit spree.root_path
17
-
18
- click_link "RoR Mug"
19
- click_button "add-to-cart-button"
20
-
21
- address = "order_bill_address_attributes"
22
- @country_css = "#{address}_country_id"
23
- @state_select_css = "##{address}_state_id"
24
- @state_name_css = "##{address}_state_name"
25
- end
26
-
27
- context "country requires state", js: true, focus: true do
28
- let!(:canada) { create(:country, name: "Canada", states_required: true, iso: "CA") }
29
- let!(:uk) { create(:country, name: "United Kingdom", states_required: true, iso: "UK") }
30
-
31
- before { Spree::Config[:default_country_id] = uk.id }
32
-
33
- context "but has no state" do
34
- it "shows the state input field" do
35
- click_button "Checkout"
36
-
37
- select canada.name, from: @country_css
38
- expect(page).to have_selector(@state_select_css, visible: false)
39
- expect(page).to have_selector(@state_name_css, visible: true)
40
- expect(find(@state_name_css)['class']).not_to match(/hidden/)
41
- expect(find(@state_name_css)['class']).to match(/required/)
42
- expect(find(@state_select_css)['class']).not_to match(/required/)
43
- expect(page).not_to have_selector("input#{@state_name_css}[disabled]")
44
- end
45
- end
46
-
47
- context "and has state" do
48
- before { create(:state, name: "Ontario", country: canada) }
49
-
50
- it "shows the state collection selection" do
51
- click_button "Checkout"
52
-
53
- select canada.name, from: @country_css
54
- expect(page).to have_selector(@state_select_css, visible: true)
55
- expect(page).to have_selector(@state_name_css, visible: false)
56
- expect(find(@state_select_css)['class']).to match(/required/)
57
- expect(find(@state_select_css)['class']).not_to match(/hidden/)
58
- expect(find(@state_name_css)['class']).not_to match(/required/)
59
- end
60
- end
61
-
62
- context "user changes to country without states required" do
63
- let!(:france) { create(:country, name: "France", states_required: false, iso: "FRA") }
64
-
65
- it "clears the state name" do
66
- skip "This is failing on the CI server, but not when you run the tests manually... It also does not fail locally on a machine."
67
- click_button "Checkout"
68
- select canada.name, from: @country_css
69
- page.find(@state_name_css).set("Toscana")
70
-
71
- select france.name, from: @country_css
72
- expect(page.find(@state_name_css)).to have_content('')
73
- until page.evaluate_script("$.active").to_i == 0
74
- expect(find(@state_name_css)['class']).not_to match(/hidden/)
75
- expect(find(@state_name_css)['class']).not_to match(/required/)
76
- expect(find(@state_select_css)['class']).not_to match(/required/)
77
- end
78
- end
79
- end
80
- end
81
-
82
- context "country does not require state", js: true do
83
- let!(:france) { create(:country, name: "France", states_required: false, iso: "FRA") }
84
-
85
- it "shows a disabled state input field" do
86
- click_button "Checkout"
87
-
88
- select france.name, from: @country_css
89
- expect(page).to have_selector(@state_select_css, visible: false)
90
- expect(page).to have_selector(@state_name_css, visible: false)
91
- end
92
- end
93
- end
@@ -1,47 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Automatic promotions", type: :feature, js: true do
4
- let!(:country) { create(:country, name: "United States of America", states_required: true) }
5
- let!(:state) { create(:state, name: "Alabama", country: country) }
6
- let!(:zone) { create(:zone) }
7
- let!(:shipping_method) { create(:shipping_method) }
8
- let!(:payment_method) { create(:check_payment_method) }
9
- let!(:product) { create(:product, name: "RoR Mug", price: 20) }
10
-
11
- let!(:promotion) do
12
- promotion = Spree::Promotion.create!(name: "$10 off when you spend more than $100")
13
-
14
- calculator = Spree::Calculator::FlatRate.new
15
- calculator.preferred_amount = 10
16
-
17
- rule = Spree::Promotion::Rules::ItemTotal.create
18
- rule.preferred_amount_min = 100
19
- rule.save
20
-
21
- promotion.rules << rule
22
-
23
- action = Spree::Promotion::Actions::CreateAdjustment.create
24
- action.calculator = calculator
25
- action.save
26
-
27
- promotion.actions << action
28
- end
29
-
30
- context "on the cart page" do
31
-
32
- before do
33
- visit spree.root_path
34
- click_link product.name
35
- click_button "add-to-cart-button"
36
- end
37
-
38
- it "automatically applies the promotion once the order crosses the threshold" do
39
- fill_in "order_line_items_attributes_0_quantity", with: 10
40
- click_button "Update"
41
- expect(page).to have_content("Promotion ($10 off when you spend more than $100) -$10.00")
42
- fill_in "order_line_items_attributes_0_quantity", with: 1
43
- click_button "Update"
44
- expect(page).not_to have_content("Promotion ($10 off when you spend more than $100) -$10.00")
45
- end
46
- end
47
- end
@@ -1,59 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'products', type: :feature, caching: true do
4
- let!(:product) { create(:product) }
5
- let!(:product2) { create(:product) }
6
- let!(:taxonomy) { create(:taxonomy) }
7
- let!(:taxon) { create(:taxon, taxonomy: taxonomy) }
8
-
9
- before { Timecop.scale(1000) }
10
-
11
- after { Timecop.return }
12
-
13
- before do
14
- product2.update_column(:updated_at, 1.day.ago)
15
- # warm up the cache
16
- visit spree.root_path
17
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
18
- assert_written_to_cache("views/en/USD/spree/products/#{product.id}-#{product.updated_at.utc.to_s(:number)}")
19
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
20
- assert_written_to_cache("views/en/taxons/#{taxon.updated_at.utc.to_i}")
21
-
22
- clear_cache_events
23
- end
24
-
25
- it "reads from cache upon a second viewing" do
26
- visit spree.root_path
27
- expect(cache_writes.count).to eq(0)
28
- end
29
-
30
- it "busts the cache when a product is updated" do
31
- product.update_column(:updated_at, 1.day.from_now)
32
- visit spree.root_path
33
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
34
- assert_written_to_cache("views/en/USD/spree/products/#{product.id}-#{product.updated_at.utc.to_s(:number)}")
35
- expect(cache_writes.count).to eq(2)
36
- end
37
-
38
- it "busts the cache when all products are deleted" do
39
- product.destroy
40
- product2.destroy
41
- visit spree.root_path
42
- assert_written_to_cache("views/en/USD/spree/products/all--#{Date.today.to_s(:number)}-0")
43
- expect(cache_writes.count).to eq(1)
44
- end
45
-
46
- it "busts the cache when the newest product is deleted" do
47
- product.destroy
48
- visit spree.root_path
49
- assert_written_to_cache("views/en/USD/spree/products/all--#{product2.updated_at.utc.to_s(:number)}")
50
- expect(cache_writes.count).to eq(1)
51
- end
52
-
53
- it "busts the cache when an older product is deleted" do
54
- product2.destroy
55
- visit spree.root_path
56
- assert_written_to_cache("views/en/USD/spree/products/all--#{product.updated_at.utc.to_s(:number)}")
57
- expect(cache_writes.count).to eq(1)
58
- end
59
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'taxons', type: :feature, caching: true do
4
- let!(:taxonomy) { create(:taxonomy) }
5
- let!(:taxon) { create(:taxon, taxonomy: taxonomy) }
6
-
7
- before do
8
- # warm up the cache
9
- visit spree.root_path
10
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
11
- assert_written_to_cache("views/en/taxons/#{taxon.updated_at.utc.to_i}")
12
-
13
- clear_cache_events
14
- end
15
-
16
- it "busts the cache when max_level_in_taxons_menu conf changes" do
17
- Spree::Config[:max_level_in_taxons_menu] = 5
18
- visit spree.root_path
19
- assert_written_to_cache("views/en/spree/taxonomies/#{taxonomy.id}")
20
- expect(cache_writes.count).to eq(1)
21
- end
22
- end
@@ -1,132 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Cart", type: :feature, inaccessible: true do
4
- before { Timecop.scale(100) }
5
-
6
- after { Timecop.return }
7
-
8
- let!(:variant) { create(:variant) }
9
- let!(:product) { variant.product }
10
-
11
- def add_mug_to_cart
12
- visit spree.root_path
13
- click_link product.name
14
- click_button "add-to-cart-button"
15
- end
16
-
17
- it "shows cart icon on non-cart pages" do
18
- visit spree.root_path
19
- expect(page).to have_selector("li#link-to-cart a", visible: true)
20
- end
21
-
22
- it "prevents double clicking the remove button on cart", js: true do
23
- add_mug_to_cart
24
- # prevent form submit to verify button is disabled
25
- page.execute_script("$('#update-cart').submit(function(){return false;})")
26
-
27
- expect(page).not_to have_selector('button#update-button[disabled]')
28
- page.find(:css, '.delete span').click
29
- expect(page).to have_selector('button#update-button[disabled]')
30
- end
31
-
32
- # Regression test for #2006
33
- it "does not error out with a 404 when GET'ing to /orders/populate" do
34
- visit '/orders/populate'
35
- within(".alert-error") do
36
- expect(page).to have_content(Spree.t(:populate_get_error))
37
- end
38
- end
39
-
40
- it 'allows you to remove an item from the cart', js: true do
41
- add_mug_to_cart
42
- line_item = Spree::LineItem.first!
43
- within("#line_items") do
44
- click_link "delete_line_item_#{line_item.id}"
45
- end
46
-
47
- expect(page).to_not have_content("Line items quantity must be an integer")
48
- expect(page).to_not have_content(product.name)
49
- expect(page).to have_content("Your cart is empty")
50
-
51
- within "#link-to-cart" do
52
- expect(page).to have_content("Empty")
53
- end
54
- end
55
-
56
- it 'allows you to empty the cart', js: true do
57
- add_mug_to_cart
58
- expect(page).to have_content(product.name)
59
- click_on "Empty Cart"
60
- expect(page).to have_content("Your cart is empty")
61
-
62
- within "#link-to-cart" do
63
- expect(page).to have_content("Empty")
64
- end
65
- end
66
-
67
- # regression for #2276
68
- context "product contains variants but no option values" do
69
- before { variant.option_values.destroy_all }
70
-
71
- it "still adds product to cart", inaccessible: true do
72
- add_mug_to_cart
73
- visit spree.cart_path
74
- expect(page).to have_content(product.name)
75
- end
76
- end
77
-
78
- it "should have a surrounding element with data-hook='cart_container'" do
79
- visit spree.cart_path
80
- expect(page).to have_selector("div[data-hook='cart_container']")
81
- end
82
-
83
- describe 'add promotion coupon on cart page', js: true do
84
- let!(:promotion) { Spree::Promotion.create(name: 'Huhuhu', code: 'huhu') }
85
- let!(:calculator) { Spree::Calculator::FlatPercentItemTotal.create(preferred_flat_percent: '10') }
86
- let!(:action) { Spree::Promotion::Actions::CreateItemAdjustments.create(calculator: calculator) }
87
-
88
- before do
89
- promotion.actions << action
90
- add_mug_to_cart
91
- expect(current_path).to eql(spree.cart_path)
92
- end
93
-
94
- def apply_coupon(code)
95
- fill_in 'Coupon Code', with: code
96
- click_on 'Update'
97
- end
98
-
99
- context 'valid coupon' do
100
- before { apply_coupon(promotion.code) }
101
-
102
- context 'for the first time' do
103
- it 'makes sure payment reflects order total with discounts' do
104
- expect(page).to have_content(promotion.name)
105
- end
106
- end
107
-
108
- context 'same coupon for the second time' do
109
- before { apply_coupon(promotion.code) }
110
- it 'should reflect an error that coupon already applied' do
111
- apply_coupon(promotion.code)
112
- expect(page).to have_content(Spree.t(:coupon_code_already_applied))
113
- expect(page).to have_content(promotion.name)
114
- end
115
- end
116
- end
117
-
118
- context 'invalid coupon' do
119
- it 'doesnt create a payment record' do
120
- apply_coupon('invalid')
121
- expect(page).to have_content(Spree.t(:coupon_code_not_found))
122
- end
123
- end
124
-
125
- context "doesn't fill in coupon code input" do
126
- it 'advances just fine' do
127
- click_on 'Update'
128
- expect(current_path).to match(spree.cart_path)
129
- end
130
- end
131
- end
132
- end
@@ -1,723 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Checkout', type: :feature, inaccessible: true, js: true do
4
- include_context 'checkout setup'
5
-
6
- let(:country) { create(:country, name: 'United States of America', iso_name: 'UNITED STATES') }
7
- let(:state) { create(:state, name: 'Alabama', abbr: 'AL', country: country) }
8
-
9
- context "visitor makes checkout as guest without registration" do
10
- before(:each) do
11
- stock_location.stock_items.update_all(count_on_hand: 1)
12
- end
13
-
14
- context 'defaults to use billing address' do
15
- before do
16
- add_mug_to_cart
17
- Spree::Order.last.update_column(:email, 'test@example.com')
18
- click_button 'Checkout'
19
- end
20
-
21
- it 'should default checkbox to checked' do
22
- expect(find('input#order_use_billing')).to be_checked
23
- end
24
-
25
- it 'should remain checked when used and visitor steps back to address step' do
26
- fill_in_address
27
- expect(find('input#order_use_billing')).to be_checked
28
- end
29
- end
30
-
31
- # Regression test for #4079
32
- context 'persists state when on address page' do
33
- before do
34
- add_mug_to_cart
35
- click_button 'Checkout'
36
- end
37
-
38
- specify do
39
- expect(Spree::Order.count).to eq 1
40
- expect(Spree::Order.last.state).to eq 'address'
41
- end
42
- end
43
-
44
- # Regression test for #1596
45
- context 'full checkout' do
46
- before do
47
- shipping_method.calculator.update!(preferred_amount: 10)
48
- mug.shipping_category = shipping_method.shipping_categories.first
49
- mug.save!
50
- end
51
-
52
- it 'does not break the per-item shipping method calculator', js: true do
53
- add_mug_to_cart
54
- click_button 'Checkout'
55
-
56
- fill_in 'order_email', with: 'test@example.com'
57
- click_on 'Continue'
58
- fill_in_address
59
-
60
- click_button 'Save and Continue'
61
- expect(page).to_not have_content("undefined method `promotion'")
62
- click_button 'Save and Continue'
63
- expect(page).to have_content('Shipping total: $10.00')
64
- end
65
- end
66
-
67
- # Regression test for #4306
68
- context 'free shipping' do
69
- before do
70
- add_mug_to_cart
71
- click_button 'Checkout'
72
- fill_in 'order_email', with: 'test@example.com'
73
- click_on 'Continue'
74
- end
75
-
76
- it "should not show 'Free Shipping' when there are no shipments" do
77
- within('#checkout-summary') do
78
- expect(page).to_not have_content('Free Shipping')
79
- end
80
- end
81
- end
82
-
83
- # Regression test for #4190
84
- it 'updates state_lock_version on form submission', js: true do
85
- add_mug_to_cart
86
- click_button "Checkout"
87
-
88
- expect(find('input#order_state_lock_version', visible: false).value).to eq '0'
89
-
90
- fill_in 'order_email', with: 'test@example.com'
91
- fill_in_address
92
- click_button 'Save and Continue'
93
-
94
- expect(find('input#order_state_lock_version', visible: false).value).to eq '1'
95
- end
96
- end
97
-
98
- # Regression test for #2694 and #4117
99
- context "doesn't allow bad credit card numbers" do
100
- before(:each) do
101
- order = OrderWalkthrough.up_to(:payment)
102
- allow(order).to receive_messages confirmation_required?: true
103
- allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
104
-
105
- user = create(:user)
106
- order.user = user
107
- order.update_with_updater!
108
-
109
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
110
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
111
- end
112
-
113
- it 'redirects to payment page', inaccessible: true, js: true do
114
- visit spree.checkout_state_path(:payment)
115
- click_button 'Save and Continue'
116
- choose 'Credit Card'
117
- fill_in 'Card Number', with: '123'
118
- fill_in 'card_expiry', with: '04 / 20'
119
- fill_in 'Card Code', with: '123'
120
- click_button 'Save and Continue'
121
- click_button 'Place Order'
122
- expect(page).to have_content('Bogus Gateway: Forced failure')
123
- expect(page.current_url).to include('/checkout/payment')
124
- end
125
- end
126
-
127
- # regression test for #3945
128
- context 'when Spree::Config[:always_include_confirm_step] is true' do
129
- before do
130
- Spree::Config[:always_include_confirm_step] = true
131
- end
132
-
133
- it 'displays confirmation step', js: true do
134
- add_mug_to_cart
135
- click_button 'Checkout'
136
-
137
- fill_in 'order_email', with: 'test@example.com'
138
- click_on 'Continue'
139
- fill_in_address
140
-
141
- click_button 'Save and Continue'
142
- click_button 'Save and Continue'
143
- click_button 'Save and Continue'
144
-
145
- continue_button = find('#checkout .btn-success')
146
- expect(continue_button.value).to eq 'Place Order'
147
- end
148
- end
149
-
150
- context 'and likes to double click buttons' do
151
- let!(:user) { create(:user) }
152
-
153
- let!(:order) do
154
- order = OrderWalkthrough.up_to(:payment)
155
- allow(order).to receive_messages confirmation_required?: true
156
-
157
- order.reload
158
- order.user = user
159
- order.update_with_updater!
160
- order
161
- end
162
-
163
- before(:each) do
164
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
165
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
166
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(skip_state_validation?: true)
167
- end
168
-
169
- it 'prevents double clicking the payment button on checkout', js: true do
170
- visit spree.checkout_state_path(:payment)
171
-
172
- # prevent form submit to verify button is disabled
173
- page.execute_script("$('#checkout_form_payment').submit(function(){return false;})")
174
-
175
- expect(page).to_not have_selector('input.btn.disabled')
176
- click_button 'Save and Continue'
177
- expect(page).to have_selector('input.btn.disabled')
178
- end
179
-
180
- it 'prevents double clicking the confirm button on checkout', js: true do
181
- order.payments << create(:payment, amount: order.amount)
182
- visit spree.checkout_state_path(:confirm)
183
-
184
- # prevent form submit to verify button is disabled
185
- page.execute_script("$('#checkout_form_confirm').submit(function(){return false;})")
186
-
187
- expect(page).to_not have_selector('input.btn.disabled')
188
- click_button 'Place Order'
189
- expect(page).to have_selector('input.btn.disabled')
190
- end
191
- end
192
-
193
- context 'when several payment methods are available', js: true do
194
- let(:credit_cart_payment) { create(:credit_card_payment_method) }
195
- let(:check_payment) { create(:check_payment_method) }
196
-
197
- after do
198
- Capybara.ignore_hidden_elements = true
199
- end
200
-
201
- before do
202
- Capybara.ignore_hidden_elements = false
203
- order = OrderWalkthrough.up_to(:payment)
204
- allow(order).to receive_messages(available_payment_methods: [check_payment, credit_cart_payment])
205
- order.user = create(:user)
206
- order.update_with_updater!
207
-
208
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
209
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: order.user)
210
-
211
- visit spree.checkout_state_path(:payment)
212
- end
213
-
214
- it 'the first payment method should be selected' do
215
- payment_method_css = '#order_payments_attributes__payment_method_id_'
216
- expect(find("#{payment_method_css}#{check_payment.id}")).to be_checked
217
- expect(find("#{payment_method_css}#{credit_cart_payment.id}")).not_to be_checked
218
- end
219
-
220
- it 'the fields for the other payment methods should be hidden' do
221
- payment_method_css = '#payment_method_'
222
- expect(find("#{payment_method_css}#{check_payment.id}")).to be_visible
223
- expect(find("#{payment_method_css}#{credit_cart_payment.id}")).not_to be_visible
224
- end
225
- end
226
-
227
- context 'user has payment sources', js: true do
228
- let(:bogus) { create(:credit_card_payment_method) }
229
- let(:user) { create(:user) }
230
-
231
- let!(:credit_card) do
232
- create(:credit_card, user_id: user.id, payment_method: bogus, gateway_customer_profile_id: 'BGS-WEFWF')
233
- end
234
-
235
- before do
236
- order = OrderWalkthrough.up_to(:payment)
237
- allow(order).to receive_messages(available_payment_methods: [bogus])
238
-
239
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
240
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
241
- allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
242
-
243
- visit spree.checkout_state_path(:payment)
244
- end
245
-
246
- it 'selects first source available and customer moves on' do
247
- expect(find('#use_existing_card_yes')).to be_checked
248
-
249
- expect { click_on 'Save and Continue' }.not_to change { Spree::CreditCard.count }
250
-
251
- click_on 'Place Order'
252
- expect(current_path).to match(spree.order_path(Spree::Order.last))
253
- end
254
-
255
- it 'allows user to enter a new source' do
256
- choose 'use_existing_card_no'
257
-
258
- fill_in 'Name on card', with: 'Spree Commerce'
259
- fill_in 'Card Number', with: '4111111111111111'
260
- fill_in 'card_expiry', with: '04 / 20'
261
- fill_in 'Card Code', with: '123'
262
-
263
- expect { click_on 'Save and Continue' }.to change { Spree::CreditCard.count }.by 1
264
-
265
- click_on 'Place Order'
266
- expect(current_path).to match(spree.order_path(Spree::Order.last))
267
- end
268
- end
269
-
270
- # regression for #2921
271
- context 'goes back from payment to add another item', js: true do
272
- let!(:bag) { create(:product, name: 'RoR Bag') }
273
-
274
- it 'transit nicely through checkout steps again' do
275
- add_mug_to_cart
276
- click_on 'Checkout'
277
- fill_in 'order_email', with: 'test@example.com'
278
- click_on 'Continue'
279
- fill_in_address
280
- click_on 'Save and Continue'
281
- click_on 'Save and Continue'
282
- expect(current_path).to eql(spree.checkout_state_path('payment'))
283
-
284
- visit spree.root_path
285
- click_link bag.name
286
- click_button 'add-to-cart-button'
287
-
288
- click_on 'Checkout'
289
- click_on 'Save and Continue'
290
- click_on 'Save and Continue'
291
- click_on 'Save and Continue'
292
-
293
- expect(current_path).to match(spree.order_path(Spree::Order.last))
294
- end
295
- end
296
-
297
- context 'from payment step customer goes back to cart', js: true do
298
- before do
299
- add_mug_to_cart
300
- click_on 'Checkout'
301
- fill_in 'order_email', with: 'test@example.com'
302
- click_on 'Continue'
303
- fill_in_address
304
- click_on 'Save and Continue'
305
- click_on 'Save and Continue'
306
- expect(current_path).to eql(spree.checkout_state_path('payment'))
307
- end
308
-
309
- context 'and updates line item quantity and try to reach payment page' do
310
- let(:cart_quantity) { 3 }
311
- before do
312
- visit spree.cart_path
313
- within '.cart-item-quantity' do
314
- fill_in first('input')['name'], with: cart_quantity
315
- end
316
-
317
- click_on 'Update'
318
- end
319
-
320
- it 'redirects user back to address step' do
321
- visit spree.checkout_state_path('payment')
322
- expect(current_path).to eql(spree.checkout_state_path('address'))
323
- end
324
-
325
- it 'updates shipments properly through step address -> delivery transitions' do
326
- visit spree.checkout_state_path('payment')
327
- click_on 'Save and Continue'
328
- click_on 'Save and Continue'
329
-
330
- expect(Spree::InventoryUnit.count).to eq 1
331
- expect(Spree::InventoryUnit.first.quantity).to eq cart_quantity
332
- end
333
- end
334
-
335
- context 'and adds new product to cart and try to reach payment page' do
336
- let!(:bag) { create(:product, name: 'RoR Bag') }
337
-
338
- before do
339
- visit spree.root_path
340
- click_link bag.name
341
- click_button 'add-to-cart-button'
342
- end
343
-
344
- it 'redirects user back to address step' do
345
- visit spree.checkout_state_path('payment')
346
- expect(current_path).to eql(spree.checkout_state_path('address'))
347
- end
348
-
349
- it 'updates shipments properly through step address -> delivery transitions' do
350
- visit spree.checkout_state_path("payment")
351
- click_on 'Save and Continue'
352
- click_on 'Save and Continue'
353
-
354
- expect(Spree::InventoryUnit.count).to eq 2
355
- end
356
- end
357
- end
358
-
359
- context 'if coupon promotion, submits coupon along with payment', js: true do
360
- let!(:promotion) { Spree::Promotion.create(name: 'Huhuhu', code: 'huhu') }
361
- let!(:calculator) { Spree::Calculator::FlatPercentItemTotal.create(preferred_flat_percent: '10') }
362
- let!(:action) { Spree::Promotion::Actions::CreateItemAdjustments.create(calculator: calculator) }
363
-
364
- before do
365
- promotion.actions << action
366
-
367
- add_mug_to_cart
368
- click_on 'Checkout'
369
-
370
- fill_in 'order_email', with: 'test@example.com'
371
- click_on 'Continue'
372
- fill_in_address
373
- click_on 'Save and Continue'
374
-
375
- click_on 'Save and Continue'
376
- expect(current_path).to eql(spree.checkout_state_path('payment'))
377
- end
378
-
379
- it 'makes sure payment reflects order total with discounts' do
380
- fill_in 'Coupon Code', with: promotion.code
381
- click_on 'Save and Continue'
382
-
383
- expect(page).to have_content(promotion.name)
384
- expect(Spree::Payment.first.amount.to_f).to eq Spree::Order.last.total.to_f
385
- end
386
-
387
- context 'invalid coupon' do
388
- it 'doesnt create a payment record' do
389
- fill_in 'Coupon Code', with: 'invalid'
390
- click_on 'Save and Continue'
391
-
392
- expect(Spree::Payment.count).to eq 0
393
- expect(page).to have_content(Spree.t(:coupon_code_not_found))
394
- end
395
- end
396
-
397
- context "doesn't fill in coupon code input" do
398
- it 'advances just fine' do
399
- click_on 'Save and Continue'
400
- expect(current_path).to match(spree.order_path(Spree::Order.last))
401
- end
402
- end
403
-
404
- context 'the promotion makes order free (downgrade it total to 0.0)' do
405
- let(:promotion2) { Spree::Promotion.create(name: 'test-7450', code: 'test-7450') }
406
- let(:calculator2) do
407
- Spree::Calculator::FlatRate.create(preferences: { currency: 'USD', amount: BigDecimal.new('99999') })
408
- end
409
- let(:action2) { Spree::Promotion::Actions::CreateItemAdjustments.create(calculator: calculator2) }
410
-
411
- before { promotion2.actions << action2 }
412
-
413
- context 'user choose to pay by check' do
414
- it 'move user to complete checkout step' do
415
- fill_in 'Coupon Code', with: promotion2.code
416
- click_on 'Save and Continue'
417
-
418
- expect(page).to have_content(promotion2.name)
419
- expect(Spree::Order.last.total.to_f).to eq(0)
420
- expect(current_path).to match(spree.order_path(Spree::Order.last))
421
- end
422
- end
423
-
424
- context 'user choose to pay by card' do
425
- let(:bogus) { create(:credit_card_payment_method) }
426
- before do
427
- order = Spree::Order.last
428
- allow(order).to receive_messages(available_payment_methods: [bogus])
429
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
430
-
431
- visit spree.checkout_state_path(:payment)
432
- end
433
-
434
- it 'move user to confirmation checkout step' do
435
- fill_in 'Name on card', with: 'Spree Commerce'
436
- fill_in 'Card Number', with: '4111111111111111'
437
- fill_in 'card_expiry', with: '04 / 20'
438
- fill_in 'Card Code', with: '123'
439
-
440
- fill_in 'Coupon Code', with: promotion2.code
441
- click_on 'Save and Continue'
442
-
443
- expect(page).to have_content(promotion2.name)
444
- expect(Spree::Order.last.total.to_f).to eq(0)
445
- expect(current_path).to eql(spree.checkout_state_path('confirm'))
446
- end
447
- end
448
- end
449
- end
450
-
451
- context 'order has only payment step' do
452
- before do
453
- create(:credit_card_payment_method)
454
- @old_checkout_flow = Spree::Order.checkout_flow
455
- Spree::Order.class_eval do
456
- checkout_flow do
457
- go_to_state :payment
458
- go_to_state :confirm
459
- end
460
- end
461
-
462
- allow_any_instance_of(Spree::Order).to receive_messages email: 'spree@commerce.com'
463
-
464
- add_mug_to_cart
465
- click_on 'Checkout'
466
- end
467
-
468
- after do
469
- Spree::Order.checkout_flow(&@old_checkout_flow)
470
- end
471
-
472
- it 'goes right payment step and place order just fine' do
473
- expect(current_path).to eq spree.checkout_state_path('payment')
474
-
475
- choose 'Credit Card'
476
- fill_in 'Name on card', with: 'Spree Commerce'
477
- fill_in 'Card Number', with: '4111111111111111'
478
- fill_in 'card_expiry', with: '04 / 20'
479
- fill_in 'Card Code', with: '123'
480
- click_button 'Save and Continue'
481
-
482
- expect(current_path).to eq spree.checkout_state_path('confirm')
483
- click_button 'Place Order'
484
- end
485
- end
486
-
487
- context 'save my address' do
488
- before do
489
- stock_location.stock_items.update_all(count_on_hand: 1)
490
- add_mug_to_cart
491
- end
492
-
493
- context 'as a guest' do
494
- before do
495
- Spree::Order.last.update_column(:email, 'test@example.com')
496
- click_button 'Checkout'
497
- end
498
-
499
- it 'should not be displayed' do
500
- expect(page).to_not have_css('[data-hook=save_user_address]')
501
- end
502
- end
503
-
504
- context 'as a User' do
505
- before do
506
- user = create(:user)
507
- Spree::Order.last.update_column :user_id, user.id
508
- allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
509
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
510
- click_button 'Checkout'
511
- end
512
-
513
- it 'should be displayed' do
514
- expect(page).to have_css('[data-hook=save_user_address]')
515
- end
516
- end
517
- end
518
-
519
- context 'when order is completed' do
520
- let!(:user) { create(:user) }
521
- let!(:order) { OrderWalkthrough.up_to(:payment) }
522
-
523
- before(:each) do
524
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
525
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
526
- allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
527
-
528
- visit spree.checkout_state_path(:payment)
529
- click_button 'Save and Continue'
530
- end
531
-
532
- it 'displays a thank you message' do
533
- expect(page).to have_content(Spree.t(:thank_you_for_your_order))
534
- end
535
-
536
- it 'does not display a thank you message on that order future visits' do
537
- visit spree.order_path(order)
538
- expect(page).to_not have_content(Spree.t(:thank_you_for_your_order))
539
- end
540
- end
541
- context "order's address is outside the default included tax zone" do
542
- context "so that no taxation applies to its product" do
543
- before do
544
- usa = Spree::Country.find_by(name: 'United States of America')
545
- north_america_zone = create(:zone,
546
- name: 'North America',
547
- kind: 'country',
548
- default_tax: true).tap do |zone|
549
- zone.members << create(:zone_member, zoneable: usa)
550
- end
551
-
552
- australia = create(:country,
553
- name: 'Australia',
554
- iso: 'AU',
555
- iso_name: 'AUSTRALIA',
556
- iso3: 'AUS',
557
- states_required: true).tap do |country|
558
- country.states << create(:state,
559
- name: 'New South Wales',
560
- abbr: 'NSW')
561
- end
562
- australia_zone = create(:zone,
563
- name: 'Australia',
564
- kind: 'country',
565
- default_tax: false).tap do |zone|
566
- zone.members << create(:zone_member, zoneable: australia)
567
- end
568
-
569
- default_tax_category = create(:tax_category, name: 'Default', is_default: true)
570
-
571
- create(:shipping_method,
572
- name: 'Default',
573
- display_on: 'both',
574
- zones: [australia_zone],
575
- tax_category: default_tax_category).tap do |sm|
576
- sm.calculator.preferred_amount = 10
577
- sm.calculator.preferred_currency = Spree::Config[:currency]
578
- sm.calculator.save
579
- end
580
-
581
- create(:tax_rate,
582
- name: 'USA included',
583
- amount: 0.23,
584
- zone: north_america_zone,
585
- tax_category: default_tax_category,
586
- show_rate_in_label: true,
587
- included_in_price: true)
588
-
589
- create(:product, name: 'Spree Bag', price: 100, tax_category: default_tax_category)
590
- create(:product, name: 'Spree T-Shirt', price: 100, tax_category: default_tax_category)
591
- end
592
-
593
- it "correctly displays other product taxless price which has been added to cart later" do
594
- visit spree.root_path
595
-
596
- click_link 'Spree Bag'
597
- click_on 'Add To Cart'
598
- click_on 'Checkout'
599
-
600
- fill_in 'order_email', with: 'test@example.com'
601
-
602
- within '#checkout_form_address' do
603
- address = 'order_bill_address_attributes'
604
-
605
- fill_in "#{address}_firstname", with: 'John'
606
- fill_in "#{address}_lastname", with: 'Doe'
607
- fill_in "#{address}_address1", with: '199 George Street'
608
- fill_in "#{address}_city", with: 'Sydney'
609
- select 'Australia', from: "#{address}_country_id"
610
- select 'New South Wales', from: "#{address}_state_id"
611
- fill_in "#{address}_zipcode", with: '2000'
612
- fill_in "#{address}_phone", with: '123456789'
613
- end
614
- click_on 'Save and Continue'
615
-
616
- visit spree.root_path
617
-
618
- click_link 'Spree T-Shirt'
619
- click_on 'Add To Cart'
620
-
621
- expect(page).not_to have_content('$100.00')
622
-
623
- page.all('td.cart-item-price').each do |line_item|
624
- expect(line_item).to have_content('$81.30')
625
- end
626
- end
627
- end
628
- end
629
-
630
- context 'user has store credits', js: true do
631
- let(:bogus) { create(:credit_card_payment_method) }
632
- let(:store_credit_payment_method) { create(:store_credit_payment_method) }
633
- let(:user) { create(:user) }
634
- let(:order) { OrderWalkthrough.up_to(:payment) }
635
-
636
- let(:prepare_checkout!) do
637
- order.update(user: user)
638
- allow(order).to receive_messages(available_payment_methods: [bogus, store_credit_payment_method])
639
-
640
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
641
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
642
- allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
643
- visit spree.checkout_state_path(:payment)
644
- end
645
-
646
- context 'when not all Store Credits are used' do
647
- let!(:store_credit) { create(:store_credit, user: user) }
648
- let!(:additional_store_credit) { create(:store_credit, user: user, amount: 13) }
649
-
650
- before { prepare_checkout! }
651
-
652
- it 'page has data for (multiple) Store Credits' do
653
- expect(page).to have_selector('[data-hook="checkout_payment_store_credit_available"]')
654
- expect(page).to have_selector('button[name="apply_store_credit"]')
655
-
656
- amount = Spree::Money.new(store_credit.amount_remaining + additional_store_credit.amount_remaining)
657
- expect(page).to have_content(Spree.t('store_credit.available_amount', amount: amount))
658
- end
659
-
660
- it 'apply store credits button should move checkout to next step if amount is sufficient' do
661
- click_button 'Apply Store Credit'
662
- expect(current_path).to eq spree.order_path(order)
663
- expect(page).to have_content(Spree.t('order_processed_successfully'))
664
- end
665
-
666
- it 'apply store credits button should wait on payment step for other payment' do
667
- store_credit.update(amount_used: 145)
668
- additional_store_credit.update(amount_used: 12)
669
- click_button 'Apply Store Credit'
670
-
671
- expect(current_path).to eq spree.checkout_state_path(:payment)
672
- amount = Spree::Money.new(store_credit.amount_remaining + additional_store_credit.amount_remaining)
673
- remaining_amount = Spree::Money.new(order.total - amount.money.to_f)
674
- expect(page).to have_content(Spree.t('store_credit.applicable_amount', amount: amount))
675
- expect(page).to have_content(Spree.t('store_credit.additional_payment_needed', amount: remaining_amount))
676
- expect(page).to have_content(Spree.t('store_credit.remove'))
677
- end
678
-
679
- context 'remove store credits payments' do
680
- before do
681
- store_credit.update(amount: 5)
682
- additional_store_credit.update(amount: 5)
683
- click_button 'Apply Store Credit'
684
- end
685
- it 'remove store credits button should remove store_credits' do
686
- click_button 'Remove Store Credit'
687
- expect(current_path).to eq spree.checkout_state_path(:payment)
688
- expect(page).to have_content(Spree.t('store_credit.available_amount', amount: order.display_total_available_store_credit))
689
- expect(page).to have_selector('button[name="apply_store_credit"]')
690
- end
691
- end
692
- end
693
-
694
- context 'when all Store Credits are used' do
695
- let!(:store_credit) { create(:store_credit, user: user, amount_used: 150) }
696
-
697
- before { prepare_checkout! }
698
-
699
- it 'page has no data for Store Credits when all Store Credits are used' do
700
- expect(page).to_not have_selector('[data-hook="checkout_payment_store_credit_available"]')
701
- expect(page).to_not have_selector('button[name="apply_store_credit"]')
702
- end
703
- end
704
- end
705
-
706
- def fill_in_address
707
- address = "order_bill_address_attributes"
708
- fill_in "#{address}_firstname", with: "Ryan"
709
- fill_in "#{address}_lastname", with: "Bigg"
710
- fill_in "#{address}_address1", with: "143 Swan Street"
711
- fill_in "#{address}_city", with: "Richmond"
712
- select country.name, from: "#{address}_country_id"
713
- select state.name, from: "#{address}_state_id"
714
- fill_in "#{address}_zipcode", with: "12345"
715
- fill_in "#{address}_phone", with: "(555) 555-5555"
716
- end
717
-
718
- def add_mug_to_cart
719
- visit spree.root_path
720
- click_link mug.name
721
- click_button "add-to-cart-button"
722
- end
723
- end