solidus_frontend 2.6.6 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 64d3918415ceeae1cc04e78c49c0608160d0f54a2a064b58cccfe36d9c756ac7
4
- data.tar.gz: a16fb9a2ea89f7bdd12b3161151c1d1aef6a1def1ff179b4ce8fd77c5cb8ce30
2
+ SHA1:
3
+ metadata.gz: f93efb17a172ec80966788d2091045939cc53f3c
4
+ data.tar.gz: 771c644fb04e3d9c22d81514bf92b632c259c042
5
5
  SHA512:
6
- metadata.gz: 38e9de1b3e44c58af76a2dd1e4f8cfd1b0b6d2c507aa2706760733721048cef436c795d6afeb38650c05dd3d04c457f7455e06103e77263bfdc97809aed4e21f
7
- data.tar.gz: 73300ce7108565be44e66382d158ee5d8b29bb5dc3a8eb31394bcb17003261c3505e68853afb53425d6fee07e1436c574e4a865a071d90578d5ac103a8cfeba6
6
+ metadata.gz: 5db460e348131768ed73ff6e4e7ab72fb3903bafe0c531b124cfacb32a2b8d2b67c8b7a3d3e688ea97080af5760b57d2ea16a6ef5a10f8299bb2f79db81be79c
7
+ data.tar.gz: 5c21bb80b91a4b6ed2cf639841a3ffcc2c36fadebe54037b7c9743ad28bc4b82a1bc3a2fe06a1e427434348e74f0b25dd7ab7221d90cfe808fb04e0f3725dacb
@@ -1,4 +1,5 @@
1
1
  Spree.onCouponCodeApply = function(e) {
2
+ e.preventDefault();
2
3
  var couponCodeField = $("#order_coupon_code");
3
4
  var couponCode = $.trim(couponCodeField.val());
4
5
  if (couponCode === "") {
@@ -948,9 +948,35 @@ p[data-hook="use_billing"] {
948
948
  padding: 5px;
949
949
  }
950
950
 
951
+ .coupon-code {
952
+ margin-top: 20px;
953
+ padding: 10px;
954
+
955
+ form {
956
+ display: flex;
957
+ flex-flow: row wrap;
958
+ }
959
+
960
+ label {
961
+ flex: 1 100%;
962
+ text-align: left;
963
+ }
964
+
965
+ input[type="text"] {
966
+ flex: 3 0;
967
+ width: 100%;
968
+ margin-right: 5px;
969
+ }
970
+
971
+ &-apply-button {
972
+ white-space: nowrap;
973
+ }
974
+ }
975
+
951
976
  #coupon_status {
977
+ margin-top: 10px;
952
978
  font-weight: bold;
953
- font-size: 125%;
979
+ font-size: 100%;
954
980
  &.success {
955
981
  color: $c_green;
956
982
  }
@@ -166,6 +166,23 @@ module Spree
166
166
  spree.order_path(@order)
167
167
  end
168
168
 
169
+ def apply_coupon_code
170
+ if update_params[:coupon_code].present?
171
+ @order.coupon_code = update_params[:coupon_code]
172
+
173
+ handler = PromotionHandler::Coupon.new(@order).apply
174
+
175
+ if handler.error.present?
176
+ flash.now[:error] = handler.error
177
+ elsif handler.success
178
+ flash[:success] = handler.success
179
+ end
180
+
181
+ setup_for_current_state
182
+ respond_with(@order) { |format| format.html { render :edit } } && return
183
+ end
184
+ end
185
+
169
186
  def setup_for_current_state
170
187
  method_name = :"before_#{@order.state}"
171
188
  send(method_name) if respond_to?(method_name, true)
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Spree
4
4
  class OrdersController < Spree::StoreController
5
- before_action :check_authorization
6
5
  helper 'spree/products', 'spree/orders'
7
6
 
8
7
  respond_to :html
9
8
 
9
+ before_action :store_guest_token
10
10
  before_action :assign_order, only: :update
11
11
  # note: do not lock the #edit action because that's where we redirect when we fail to acquire a lock
12
12
  around_action :lock_order, only: :update
@@ -15,9 +15,11 @@ module Spree
15
15
 
16
16
  def show
17
17
  @order = Spree::Order.find_by!(number: params[:id])
18
+ authorize! :read, @order, cookies.signed[:guest_token]
18
19
  end
19
20
 
20
21
  def update
22
+ authorize! :update, @order, cookies.signed[:guest_token]
21
23
  if @order.contents.update_cart(order_params)
22
24
  @order.next if params.key?(:checkout) && @order.cart?
23
25
 
@@ -38,12 +40,15 @@ module Spree
38
40
  # Shows the current incomplete order from the session
39
41
  def edit
40
42
  @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])
43
+ authorize! :read, @order, cookies.signed[:guest_token]
41
44
  associate_user
42
45
  end
43
46
 
44
47
  # Adds a new item to the order (creating a new order if none already exists)
45
48
  def populate
46
- @order = current_order(create_order_if_necessary: true)
49
+ @order = current_order(create_order_if_necessary: true)
50
+ authorize! :update, @order, cookies.signed[:guest_token]
51
+
47
52
  variant = Spree::Variant.find(params[:variant_id])
48
53
  quantity = params[:quantity].present? ? params[:quantity].to_i : 1
49
54
 
@@ -78,6 +83,7 @@ module Spree
78
83
 
79
84
  def empty
80
85
  if @order = current_order
86
+ authorize! :update, @order, cookies.signed[:guest_token]
81
87
  @order.empty!
82
88
  end
83
89
 
@@ -92,19 +98,12 @@ module Spree
92
98
  end
93
99
  end
94
100
 
95
- def check_authorization
96
- cookies.permanent.signed[:guest_token] = params[:token] if params[:token]
97
- order = Spree::Order.find_by(number: params[:id]) || current_order
101
+ private
98
102
 
99
- if order
100
- authorize! :edit, order, cookies.signed[:guest_token]
101
- else
102
- authorize! :create, Spree::Order
103
- end
103
+ def store_guest_token
104
+ cookies.permanent.signed[:guest_token] = params[:token] if params[:token]
104
105
  end
105
106
 
106
- private
107
-
108
107
  def order_params
109
108
  if params[:order]
110
109
  params[:order].permit(*permitted_order_attributes)
@@ -120,5 +119,20 @@ module Spree
120
119
  redirect_to(root_path) && return
121
120
  end
122
121
  end
122
+
123
+ def apply_coupon_code
124
+ if order_params[:coupon_code].present?
125
+ @order.coupon_code = order_params[:coupon_code]
126
+
127
+ handler = PromotionHandler::Coupon.new(@order).apply
128
+
129
+ if handler.error.present?
130
+ flash.now[:error] = handler.error
131
+ respond_with(@order) { |format| format.html { render :edit } } && return
132
+ elsif handler.success
133
+ flash[:success] = handler.success
134
+ end
135
+ end
136
+ end
123
137
  end
124
138
  end
@@ -16,24 +16,6 @@ module Spree
16
16
 
17
17
  private
18
18
 
19
- # This method is placed here so that the CheckoutController
20
- # and OrdersController can both reference it (or any other controller
21
- # which needs it)
22
- def apply_coupon_code
23
- if params[:order] && params[:order][:coupon_code]
24
- @order.coupon_code = params[:order][:coupon_code]
25
-
26
- handler = PromotionHandler::Coupon.new(@order).apply
27
-
28
- if handler.error.present?
29
- flash.now[:error] = handler.error
30
- respond_with(@order) { |format| format.html { render :edit } } && return
31
- elsif handler.success
32
- flash[:success] = handler.success
33
- end
34
- end
35
- end
36
-
37
19
  def config_locale
38
20
  Spree::Frontend::Config[:locale]
39
21
  end
@@ -4,12 +4,11 @@ module Spree
4
4
  class TaxonsController < Spree::StoreController
5
5
  helper 'spree/products', 'spree/taxon_filters'
6
6
 
7
+ before_action :load_taxon, only: [:show]
8
+
7
9
  respond_to :html
8
10
 
9
11
  def show
10
- @taxon = Spree::Taxon.find_by!(permalink: params[:id])
11
- return unless @taxon
12
-
13
12
  @searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true))
14
13
  @products = @searcher.retrieve_products
15
14
  @taxonomies = Spree::Taxonomy.includes(root: :children)
@@ -17,6 +16,10 @@ module Spree
17
16
 
18
17
  private
19
18
 
19
+ def load_taxon
20
+ @taxon = Spree::Taxon.find_by!(permalink: params[:id])
21
+ end
22
+
20
23
  def accurate_title
21
24
  if @taxon
22
25
  @taxon.seo_title
@@ -0,0 +1,12 @@
1
+ <div class="coupon-code" data-hook='coupon_code'>
2
+ <%= form_for order, url: update_checkout_path(order.state) do |form| %>
3
+ <%= form.label :coupon_code %>
4
+ <%= form.text_field :coupon_code, placeholder: :coupon_code %>
5
+
6
+ <button type="submit" class="button coupon-code-apply-button" id="coupon-code-apply-button">
7
+ <%= t('spree.apply_code') %>
8
+ </button>
9
+ <% end %>
10
+
11
+ <div id='coupon_status'></div>
12
+ </div>
@@ -56,16 +56,6 @@
56
56
  <% end %>
57
57
  </ul>
58
58
  <br style="clear:both;" />
59
- <p class='field' data-hook='coupon_code'>
60
- <%= form.label :coupon_code %>
61
- <%= form.text_field :coupon_code %>
62
- <button type="button" class="button" id="coupon-code-apply-button">
63
- <%= t('spree.apply_code') %>
64
- </button>
65
-
66
- </p>
67
- <div id='coupon_status'></div>
68
-
69
59
  </div>
70
60
  </fieldset>
71
61
 
@@ -70,3 +70,7 @@
70
70
  </tr>
71
71
  </tbody>
72
72
  </table>
73
+
74
+ <% if order.state == 'payment' %>
75
+ <%= render 'coupon_code', order: order %>
76
+ <% end %>
@@ -478,4 +478,62 @@ describe Spree::CheckoutController, type: :controller do
478
478
  post :update, params: { state: "payment" }
479
479
  }.to change { order.line_items.to_a.size }.from(1).to(0)
480
480
  end
481
+
482
+ context 'trying to apply a coupon code' do
483
+ let(:order) { create(:order_with_line_items, state: 'payment', guest_token: 'a token') }
484
+ let(:coupon_code) { "coupon_code" }
485
+
486
+ before { cookies.signed[:guest_token] = order.guest_token }
487
+
488
+ context "when coupon code is empty" do
489
+ let(:coupon_code) { "" }
490
+
491
+ it 'does not try to apply coupon code' do
492
+ expect(Spree::PromotionHandler::Coupon).not_to receive :new
493
+
494
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
495
+
496
+ expect(response).to redirect_to(spree.checkout_state_path('confirm'))
497
+ end
498
+ end
499
+
500
+ context "when coupon code is applied" do
501
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: nil, success: 'Coupon Applied!') }
502
+
503
+ it "continues checkout flow normally" do
504
+ expect(Spree::PromotionHandler::Coupon)
505
+ .to receive_message_chain(:new, :apply)
506
+ .and_return(promotion_handler)
507
+
508
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
509
+
510
+ expect(response).to render_template :edit
511
+ expect(flash.now[:success]).to eq('Coupon Applied!')
512
+ end
513
+
514
+ context "when coupon code is not applied" do
515
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: 'Some error', success: false) }
516
+
517
+ it "setups the current step correctly before rendering" do
518
+ expect(Spree::PromotionHandler::Coupon)
519
+ .to receive_message_chain(:new, :apply)
520
+ .and_return(promotion_handler)
521
+ expect(controller).to receive(:setup_for_current_state)
522
+
523
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
524
+ end
525
+
526
+ it "render cart with coupon error" do
527
+ expect(Spree::PromotionHandler::Coupon)
528
+ .to receive_message_chain(:new, :apply)
529
+ .and_return(promotion_handler)
530
+
531
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
532
+
533
+ expect(response).to render_template :edit
534
+ expect(flash.now[:error]).to eq('Some error')
535
+ end
536
+ end
537
+ end
538
+ end
481
539
  end
@@ -18,7 +18,6 @@ module Spree
18
18
 
19
19
  context 'when an order exists in the cookies.signed' do
20
20
  let(:token) { 'some_token' }
21
- let(:specified_order) { create(:order) }
22
21
 
23
22
  before do
24
23
  allow(controller).to receive_messages current_order: order
@@ -26,54 +25,39 @@ module Spree
26
25
  end
27
26
 
28
27
  context '#populate' do
29
- it 'should check if user is authorized for :edit' do
30
- expect(controller).to receive(:authorize!).with(:edit, order, token)
28
+ it 'should check if user is authorized for :update' do
29
+ expect(controller).to receive(:authorize!).with(:update, order, token)
31
30
  post :populate, params: { variant_id: variant.id, token: token }
32
31
  end
33
- it "should check against the specified order" do
34
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
35
- post :populate, params: { id: specified_order.number, variant_id: variant.id, token: token }
36
- end
37
32
  end
38
33
 
39
34
  context '#edit' do
40
- it 'should check if user is authorized for :edit' do
41
- expect(controller).to receive(:authorize!).with(:edit, order, token)
35
+ it 'should check if user is authorized for :read' do
36
+ expect(controller).to receive(:authorize!).with(:read, order, token)
42
37
  get :edit, params: { token: token }
43
38
  end
44
- it "should check against the specified order" do
45
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
46
- get :edit, params: { id: specified_order.number, token: token }
47
- end
48
39
  end
49
40
 
50
41
  context '#update' do
51
- it 'should check if user is authorized for :edit' do
42
+ it 'should check if user is authorized for :update' do
52
43
  allow(order).to receive :update_attributes
53
- expect(controller).to receive(:authorize!).with(:edit, order, token)
44
+ expect(controller).to receive(:authorize!).with(:update, order, token)
54
45
  post :update, params: { order: { email: "foo@bar.com" }, token: token }
55
46
  end
56
- it "should check against the specified order" do
57
- allow(order).to receive :update_attributes
58
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
59
- post :update, params: { order: { email: "foo@bar.com" }, id: specified_order.number, token: token }
60
- end
61
47
  end
62
48
 
63
49
  context '#empty' do
64
- it 'should check if user is authorized for :edit' do
65
- expect(controller).to receive(:authorize!).with(:edit, order, token)
50
+ it 'should check if user is authorized for :update' do
51
+ expect(controller).to receive(:authorize!).with(:update, order, token)
66
52
  post :empty, params: { token: token }
67
53
  end
68
- it "should check against the specified order" do
69
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
70
- post :empty, params: { id: specified_order.number, token: token }
71
- end
72
54
  end
73
55
 
74
56
  context "#show" do
57
+ let(:specified_order) { create(:order) }
58
+
75
59
  it "should check against the specified order" do
76
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
60
+ expect(controller).to receive(:authorize!).with(:read, specified_order, token)
77
61
  get :show, params: { id: specified_order.number, token: token }
78
62
  end
79
63
  end
@@ -105,7 +105,7 @@ describe Spree::OrdersController, type: :controller do
105
105
  context "#update" do
106
106
  context "with authorization" do
107
107
  before do
108
- allow(controller).to receive :check_authorization
108
+ allow(controller).to receive :authorize!
109
109
  allow(controller).to receive_messages current_order: order
110
110
  end
111
111
 
@@ -128,12 +128,59 @@ describe Spree::OrdersController, type: :controller do
128
128
  put :update, params: { checkout: true }
129
129
  expect(response).to redirect_to checkout_state_path('address')
130
130
  end
131
+
132
+ context 'trying to apply a coupon code' do
133
+ let(:order) { create(:order_with_line_items, state: 'cart') }
134
+ let(:coupon_code) { "coupon_code" }
135
+
136
+ context "when coupon code is empty" do
137
+ let(:coupon_code) { "" }
138
+
139
+ it 'does not try to apply coupon code' do
140
+ expect(Spree::PromotionHandler::Coupon).not_to receive :new
141
+
142
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
143
+
144
+ expect(response).to redirect_to(spree.cart_path)
145
+ end
146
+ end
147
+
148
+ context "when coupon code is applied" do
149
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: nil, success: 'Coupon Applied!') }
150
+
151
+ it "continues checkout flow normally" do
152
+ expect(Spree::PromotionHandler::Coupon)
153
+ .to receive_message_chain(:new, :apply)
154
+ .and_return(promotion_handler)
155
+
156
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
157
+
158
+ expect(response).to redirect_to(spree.cart_path)
159
+ expect(flash.now[:success]).to eq('Coupon Applied!')
160
+ end
161
+
162
+ context "when coupon code is not applied" do
163
+ let(:promotion_handler) { instance_double('Spree::PromotionHandler::Coupon', error: 'Some error', success: false) }
164
+
165
+ it "render cart with coupon error" do
166
+ expect(Spree::PromotionHandler::Coupon)
167
+ .to receive_message_chain(:new, :apply)
168
+ .and_return(promotion_handler)
169
+
170
+ put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
171
+
172
+ expect(response).to render_template :edit
173
+ expect(flash.now[:error]).to eq('Some error')
174
+ end
175
+ end
176
+ end
177
+ end
131
178
  end
132
179
  end
133
180
 
134
181
  context "#empty" do
135
182
  before do
136
- allow(controller).to receive :check_authorization
183
+ allow(controller).to receive :authorize!
137
184
  end
138
185
 
139
186
  it "should destroy line items in the current order" do
@@ -165,7 +212,7 @@ describe Spree::OrdersController, type: :controller do
165
212
  let!(:line_item) { order.contents.add(variant, 1) }
166
213
 
167
214
  before do
168
- allow(controller).to receive(:check_authorization)
215
+ allow(controller).to receive :authorize!
169
216
  allow(controller).to receive_messages(current_order: order)
170
217
  end
171
218
 
@@ -350,7 +350,7 @@ describe "Checkout", type: :feature, inaccessible: true do
350
350
  choose "use_existing_card_no"
351
351
 
352
352
  fill_in "Name on card", with: 'Spree Commerce'
353
- fill_in_with_force "Card Number", with: '4111 1111 1111 1111'
353
+ fill_in "Card Number", with: '4111 1111 1111 1111'
354
354
  fill_in "card_expiry", with: '04 / 20'
355
355
  fill_in "Card Code", with: '123'
356
356
 
@@ -11,7 +11,7 @@ describe "Coupon code promotions", type: :feature, js: true do
11
11
  let!(:payment_method) { create(:check_payment_method) }
12
12
  let!(:product) { create(:product, name: "RoR Mug", price: 20) }
13
13
 
14
- context "visitor makes checkout as guest without registration" do
14
+ context "visitor makes checkout" do
15
15
  def create_basic_coupon_promotion(code)
16
16
  promotion = create(
17
17
  :promotion,
@@ -34,50 +34,90 @@ describe "Coupon code promotions", type: :feature, js: true do
34
34
 
35
35
  let!(:promotion) { create_basic_coupon_promotion("onetwo") }
36
36
 
37
- # OrdersController
38
37
  context "on the payment page" do
39
- before do
40
- visit spree.root_path
41
- click_link "RoR Mug"
42
- click_button "add-to-cart-button"
43
- click_button "Checkout"
44
- fill_in "order_email", with: "spree@example.com"
45
- fill_in "First Name", with: "John"
46
- fill_in "Last Name", with: "Smith"
47
- fill_in "Street Address", with: "1 John Street"
48
- fill_in "City", with: "City of John"
49
- fill_in "Zip", with: "01337"
50
- select country.name, from: "Country"
51
- select state.name, from: "order[bill_address_attributes][state_id]"
52
- fill_in "Phone", with: "555-555-5555"
53
-
54
- # To shipping method screen
55
- click_button "Save and Continue"
56
- # To payment screen
57
- click_button "Save and Continue"
58
- end
59
-
60
- it "informs about an invalid coupon code" do
61
- fill_in "order_coupon_code", with: "coupon_codes_rule_man"
62
- click_button "Save and Continue"
63
- expect(page).to have_content(I18n.t('spree.coupon_code_not_found'))
64
- end
38
+ context "as guest without registration" do
39
+ before do
40
+ visit spree.root_path
41
+ click_link "RoR Mug"
42
+ click_button "add-to-cart-button"
43
+ click_button "Checkout"
44
+ fill_in "order_email", with: "spree@example.com"
45
+ fill_in "First Name", with: "John"
46
+ fill_in "Last Name", with: "Smith"
47
+ fill_in "Street Address", with: "1 John Street"
48
+ fill_in "City", with: "City of John"
49
+ fill_in "Zip", with: "01337"
50
+ select country.name, from: "Country"
51
+ select state.name, from: "order[bill_address_attributes][state_id]"
52
+ fill_in "Phone", with: "555-555-5555"
53
+
54
+ # To shipping method screen
55
+ click_button "Save and Continue"
56
+ # To payment screen
57
+ click_button "Save and Continue"
58
+ end
65
59
 
66
- it "can enter an invalid coupon code, then a real one" do
67
- fill_in "order_coupon_code", with: "coupon_codes_rule_man"
68
- click_button "Save and Continue"
69
- expect(page).to have_content(I18n.t('spree.coupon_code_not_found'))
70
- fill_in "order_coupon_code", with: "onetwo"
71
- click_button "Save and Continue"
72
- expect(page).to have_content("Promotion (Onetwo) -$10.00")
73
- end
60
+ it "informs about an invalid coupon code" do
61
+ fill_in "order_coupon_code", with: "coupon_codes_rule_man"
62
+ click_button "Apply Code"
63
+ expect(page).to have_content(I18n.t('spree.coupon_code_not_found'))
64
+ end
74
65
 
75
- context "with a promotion" do
76
- it "applies a promotion to an order" do
66
+ it "can enter an invalid coupon code, then a real one" do
67
+ fill_in "order_coupon_code", with: "coupon_codes_rule_man"
68
+ click_button "Apply Code"
69
+ expect(page).to have_content(I18n.t('spree.coupon_code_not_found'))
77
70
  fill_in "order_coupon_code", with: "onetwo"
78
- click_button "Save and Continue"
71
+ click_button "Apply Code"
79
72
  expect(page).to have_content("Promotion (Onetwo) -$10.00")
80
73
  end
74
+
75
+ context "with a promotion" do
76
+ it "applies a promotion to an order" do
77
+ fill_in "order_coupon_code", with: "onetwo"
78
+ click_button "Apply Code"
79
+ expect(page).to have_content("Promotion (Onetwo) -$10.00")
80
+ end
81
+ end
82
+ end
83
+
84
+ context 'as logged user' do
85
+ let!(:user) { create(:user, bill_address: create(:address), ship_address: create(:address)) }
86
+
87
+ before do
88
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
89
+ allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
90
+ end
91
+
92
+ context 'with saved credit card' do
93
+ let(:bogus) { create(:credit_card_payment_method) }
94
+ let!(:credit_card) do
95
+ create(:credit_card, user_id: user.id, payment_method: bogus, gateway_customer_profile_id: "BGS-WEFWF")
96
+ end
97
+
98
+ before do
99
+ user.wallet.add(credit_card)
100
+
101
+ visit spree.root_path
102
+ click_link "RoR Mug"
103
+ click_button "add-to-cart-button"
104
+ # To Cart
105
+ click_button "Checkout"
106
+ # To shipping method screen, address is auto-populated
107
+ # with user's saved addresses
108
+ click_button "Save and Continue"
109
+ # To payment screen
110
+ click_button "Save and Continue"
111
+ end
112
+
113
+ it "shows wallet payments on coupon code errors" do
114
+ fill_in "order_coupon_code", with: "coupon_codes_rule_man"
115
+ click_button "Apply Code"
116
+
117
+ expect(page).to have_content("The coupon code you entered doesn't exist. Please try again.")
118
+ expect(page).to have_content("Use an existing card")
119
+ end
120
+ end
81
121
  end
82
122
  end
83
123
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.6
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.6
19
+ version: 2.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.6.6
26
+ version: 2.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.6.6
33
+ version: 2.7.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.6.6
40
+ version: 2.7.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -208,6 +208,7 @@ files:
208
208
  - app/views/spree/address/_form_hidden.html.erb
209
209
  - app/views/spree/checkout/_address.html.erb
210
210
  - app/views/spree/checkout/_confirm.html.erb
211
+ - app/views/spree/checkout/_coupon_code.html.erb
211
212
  - app/views/spree/checkout/_delivery.html.erb
212
213
  - app/views/spree/checkout/_payment.html.erb
213
214
  - app/views/spree/checkout/_summary.html.erb
@@ -303,7 +304,6 @@ files:
303
304
  - spec/helpers/order_helper_spec.rb
304
305
  - spec/helpers/taxon_filters_helper_spec.rb
305
306
  - spec/spec_helper.rb
306
- - spec/support/features/fill_in_with_force.rb
307
307
  - spec/support/shared_contexts/checkout_setup.rb
308
308
  - spec/support/shared_contexts/custom_products.rb
309
309
  - spec/support/shared_contexts/locales.rb
@@ -328,7 +328,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  version: 1.8.23
329
329
  requirements:
330
330
  - none
331
- rubygems_version: 3.0.6
331
+ rubyforge_project:
332
+ rubygems_version: 2.6.10
332
333
  signing_key:
333
334
  specification_version: 4
334
335
  summary: Cart and storefront for the Solidus e-commerce project.
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FillInWithForce
4
- def fill_in_with_force(locator, with:)
5
- field_id = find_field(locator)[:id]
6
- page.execute_script "document.getElementById('#{field_id}').value = '#{with}';"
7
- end
8
- end
9
-
10
- RSpec.configure do |config|
11
- config.include FillInWithForce, type: :feature
12
- end