solidus_frontend 2.8.2 → 2.9.2
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 +4 -4
- data/app/assets/stylesheets/spree/frontend/screen.css.scss +9 -0
- data/app/controllers/spree/checkout_controller.rb +25 -3
- data/app/views/spree/checkout/payment/_gateway.html.erb +6 -5
- data/spec/controllers/controller_helpers_spec.rb +1 -2
- data/spec/controllers/spree/checkout_controller_spec.rb +1 -3
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +1 -1
- data/spec/controllers/spree/home_controller_spec.rb +1 -1
- data/spec/features/address_spec.rb +1 -1
- data/spec/features/automatic_promotion_adjustments_spec.rb +2 -2
- data/spec/features/caching/taxons_spec.rb +1 -1
- data/spec/features/checkout_spec.rb +34 -25
- data/spec/features/coupon_code_spec.rb +5 -5
- data/spec/features/currency_spec.rb +1 -1
- data/spec/features/first_order_promotion_spec.rb +59 -0
- data/spec/features/free_shipping_promotions_spec.rb +2 -2
- data/spec/features/locale_spec.rb +1 -2
- data/spec/features/products_spec.rb +8 -8
- data/spec/spec_helper.rb +0 -1
- metadata +8 -9
- data/spec/support/features/fill_in_with_force.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c870b64d502575c06ff5f6f0df58c36192f0e44b90160cadc8eaba8fb6044605
|
4
|
+
data.tar.gz: c15550288bd9ad9530f82b778d0cd5d691010c1081aa86389190ff21bbbd8d02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f14f416de8a6112bd68d9091670fbefc53903dceb613ccf13b1a1bca936e6a168bf77e556ffe56f37158cd014fc524f3768360657fe9701b55cf4e74e497b73
|
7
|
+
data.tar.gz: 2b6484627d36c539d385e1efa29dbe49b3b2f85e3837450734780e3c9c74b9eb8d03ddd8a55bca162b14fcc673d4fe883e1110aaf4bfcef244b137d3962f7244
|
@@ -1265,6 +1265,15 @@ table.order-summary {
|
|
1265
1265
|
|
1266
1266
|
}
|
1267
1267
|
|
1268
|
+
// # Logo
|
1269
|
+
#logo {
|
1270
|
+
padding: 20px 0;
|
1271
|
+
|
1272
|
+
> a {
|
1273
|
+
display: inline-block;
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
|
1268
1277
|
@media only screen and (max-width: 767px) {
|
1269
1278
|
#empty-cart {
|
1270
1279
|
clear: both;
|
@@ -219,9 +219,14 @@ module Spree
|
|
219
219
|
@wallet_payment_sources = try_spree_current_user.wallet.wallet_payment_sources
|
220
220
|
@default_wallet_payment_source = @wallet_payment_sources.detect(&:default) ||
|
221
221
|
@wallet_payment_sources.first
|
222
|
-
|
223
|
-
|
224
|
-
|
222
|
+
|
223
|
+
@payment_sources = Spree::DeprecatedInstanceVariableProxy.new(
|
224
|
+
self,
|
225
|
+
:deprecated_payment_sources,
|
226
|
+
:@payment_sources,
|
227
|
+
Spree::Deprecation,
|
228
|
+
"Please, do not use @payment_sources anymore, use @wallet_payment_sources instead."
|
229
|
+
)
|
225
230
|
end
|
226
231
|
end
|
227
232
|
|
@@ -251,5 +256,22 @@ module Spree
|
|
251
256
|
end
|
252
257
|
end
|
253
258
|
end
|
259
|
+
|
260
|
+
# This method returns payment sources of the current user. It is no more
|
261
|
+
# used into our frontend. We used to assign the content of this method
|
262
|
+
# into an ivar (@payment_sources) into the checkout payment step. This
|
263
|
+
# method is here only to be able to deprecate this ivar and will be removed.
|
264
|
+
#
|
265
|
+
# DO NOT USE THIS METHOD!
|
266
|
+
#
|
267
|
+
# @return [Array<Spree::PaymentSource>] Payment sources connected to
|
268
|
+
# current user wallet.
|
269
|
+
# @deprecated This method has been added to deprecate @payment_sources
|
270
|
+
# ivar and will be removed. Use @wallet_payment_sources instead.
|
271
|
+
def deprecated_payment_sources
|
272
|
+
try_spree_current_user.wallet.wallet_payment_sources
|
273
|
+
.map(&:payment_source)
|
274
|
+
.select { |ps| ps.is_a?(Spree::CreditCard) }
|
275
|
+
end
|
254
276
|
end
|
255
277
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
<%= image_tag 'credit_cards/credit_card.gif', id: 'credit-card-image' %>
|
2
2
|
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
3
3
|
|
4
|
-
<div class="field field-required">
|
4
|
+
<div class="field field-required card_name" data-hook="card_name">
|
5
5
|
<%= label_tag "name_on_card_#{payment_method.id}", t('spree.name_on_card') %>
|
6
|
-
<%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name" } %>
|
6
|
+
<%= text_field_tag "#{param_prefix}[name]", "#{@order.billing_firstname} #{@order.billing_lastname}", { id: "name_on_card_#{payment_method.id}", autocomplete: "cc-name", class: 'cardName' } %>
|
7
7
|
</div>
|
8
8
|
|
9
|
-
<div class="field field-required" data-hook="card_number">
|
9
|
+
<div class="field field-required card_number" data-hook="card_number">
|
10
10
|
<%= label_tag "card_number", t('spree.card_number') %>
|
11
11
|
<%= text_field_tag "#{param_prefix}[number]", '', {id: 'card_number', class: 'required cardNumber', size: 19, maxlength: 19, autocomplete: "cc-number", type: "tel" } %>
|
12
|
+
|
12
13
|
<span id="card_type" style="display:none;">
|
13
14
|
( <span id="looks_like" ><%= t('spree.card_type_is') %> <span id="type"></span></span>
|
14
15
|
<span id="unrecognized"><%= t('spree.unrecognized_card_type') %></span>
|
@@ -16,12 +17,12 @@
|
|
16
17
|
</span>
|
17
18
|
</div>
|
18
19
|
|
19
|
-
<div class="field field-required" data-hook="card_expiration">
|
20
|
+
<div class="field field-required card_expiration" data-hook="card_expiration">
|
20
21
|
<%= label_tag "card_expiry", t('spree.expiration') %>
|
21
22
|
<%= text_field_tag "#{param_prefix}[expiry]", '', id: 'card_expiry', class: "required cardExpiry", placeholder: "MM / YY", type: "tel" %>
|
22
23
|
</div>
|
23
24
|
|
24
|
-
<div class="field field-required" data-hook="card_code">
|
25
|
+
<div class="field field-required card_code" data-hook="card_code">
|
25
26
|
<%= label_tag "card_code", t('spree.card_code') %>
|
26
27
|
<%= text_field_tag "#{param_prefix}[verification_value]", '', {id: 'card_code', class: 'required cardCode', size: 5, type: "tel", autocomplete: "off" } %>
|
27
28
|
<%= link_to "(#{t('spree.what_is_this')})", spree.cvv_path, target: '_blank', "data-hook" => "cvv_link", id: "cvv_link" %>
|
@@ -8,7 +8,7 @@ require 'spec_helper'
|
|
8
8
|
describe Spree::ProductsController, type: :controller do
|
9
9
|
before do
|
10
10
|
I18n.enforce_available_locales = false
|
11
|
-
Spree::Frontend::Config
|
11
|
+
stub_spree_preferences(Spree::Frontend::Config, locale: :de)
|
12
12
|
I18n.backend.store_translations(:de, spree: {
|
13
13
|
i18n: { this_file_language: "Deutsch (DE)" }
|
14
14
|
})
|
@@ -16,7 +16,6 @@ describe Spree::ProductsController, type: :controller do
|
|
16
16
|
|
17
17
|
after do
|
18
18
|
I18n.reload!
|
19
|
-
Spree::Frontend::Config[:locale] = :en
|
20
19
|
I18n.locale = :en
|
21
20
|
I18n.enforce_available_locales = true
|
22
21
|
end
|
@@ -469,9 +469,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
469
469
|
before do
|
470
470
|
allow(order).to receive_messages(line_items: [line_item], state: "payment")
|
471
471
|
|
472
|
-
|
473
|
-
config.track_inventory_levels = true
|
474
|
-
end
|
472
|
+
stub_spree_preferences(track_inventory_levels: true)
|
475
473
|
end
|
476
474
|
|
477
475
|
context "and back orders are not allowed" do
|
@@ -16,7 +16,7 @@ describe Spree::CheckoutController, type: :controller do
|
|
16
16
|
# Regression test for https://github.com/spree/spree/issues/3246
|
17
17
|
context "when using GBP" do
|
18
18
|
before do
|
19
|
-
|
19
|
+
stub_spree_preferences(currency: "GBP")
|
20
20
|
end
|
21
21
|
|
22
22
|
context "when order is in delivery" do
|
@@ -18,7 +18,7 @@ describe Spree::HomeController, type: :controller do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
context "different layout specified in config" do
|
21
|
-
before {
|
21
|
+
before { stub_spree_preferences(layout: 'layouts/application') }
|
22
22
|
|
23
23
|
it "renders specified layout" do
|
24
24
|
get :index
|
@@ -24,7 +24,7 @@ describe "Address", type: :feature, inaccessible: true do
|
|
24
24
|
let!(:canada) { create(:country, name: "Canada", states_required: true, iso: "CA") }
|
25
25
|
let!(:uk) { create(:country, name: "United Kingdom", states_required: true, iso: "GB") }
|
26
26
|
|
27
|
-
before {
|
27
|
+
before { stub_spree_preferences(default_country_iso: uk.iso) }
|
28
28
|
|
29
29
|
context "but has no state" do
|
30
30
|
it "shows the state input field" do
|
@@ -40,10 +40,10 @@ describe "Automatic promotions", type: :feature, js: true do
|
|
40
40
|
it "automatically applies the promotion once the order crosses the threshold" do
|
41
41
|
fill_in "order_line_items_attributes_0_quantity", with: 10
|
42
42
|
click_button "Update"
|
43
|
-
expect(page).to have_content("Promotion ($10 off when you spend more than $100) -$10.00")
|
43
|
+
expect(page).to have_content("Promotion ($10 off when you spend more than $100) -$10.00", normalize_ws: true)
|
44
44
|
fill_in "order_line_items_attributes_0_quantity", with: 1
|
45
45
|
click_button "Update"
|
46
|
-
expect(page).not_to have_content("Promotion ($10 off when you spend more than $100) -$10.00")
|
46
|
+
expect(page).not_to have_content("Promotion ($10 off when you spend more than $100) -$10.00", normalize_ws: true)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -14,7 +14,7 @@ describe 'taxons', type: :feature, caching: true do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "busts the cache when max_level_in_taxons_menu conf changes" do
|
17
|
-
|
17
|
+
stub_spree_preferences(max_level_in_taxons_menu: 5)
|
18
18
|
visit spree.root_path
|
19
19
|
expect(cache_writes.count).to eq(1)
|
20
20
|
end
|
@@ -211,6 +211,26 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
+
context "when order has only a void payment" do
|
215
|
+
let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:payment) }
|
216
|
+
|
217
|
+
before do
|
218
|
+
user = create(:user)
|
219
|
+
order.user = user
|
220
|
+
order.recalculate
|
221
|
+
|
222
|
+
allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
|
223
|
+
allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
|
224
|
+
end
|
225
|
+
|
226
|
+
it "does not allow successful order submission" do
|
227
|
+
visit spree.checkout_path
|
228
|
+
order.payments.first.update state: :void
|
229
|
+
click_button 'Place Order'
|
230
|
+
expect(page).to have_current_path spree.checkout_state_path(:payment)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
214
234
|
# Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
|
215
235
|
context "doesn't allow bad credit card numbers" do
|
216
236
|
let!(:payment_method) { create(:credit_card_payment_method) }
|
@@ -338,30 +358,21 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
338
358
|
it "selects first source available and customer moves on" do
|
339
359
|
expect(find("#use_existing_card_yes")).to be_checked
|
340
360
|
|
341
|
-
|
342
|
-
click_on "Save and Continue"
|
343
|
-
}.not_to change { Spree::CreditCard.count }
|
344
|
-
|
361
|
+
click_on "Save and Continue"
|
345
362
|
click_on "Place Order"
|
346
363
|
expect(page).to have_current_path(spree.order_path(Spree::Order.last))
|
364
|
+
expect(page).to have_current_path(spree.order_path(Spree::Order.last))
|
365
|
+
expect(page).to have_content("Ending in #{credit_card.last_digits}")
|
347
366
|
end
|
348
367
|
|
349
368
|
it "allows user to enter a new source" do
|
350
369
|
choose "use_existing_card_no"
|
370
|
+
fill_in_credit_card
|
351
371
|
|
352
|
-
|
353
|
-
fill_in_with_force "Card Number", with: '4111 1111 1111 1111'
|
354
|
-
fill_in "card_expiry", with: '04 / 20'
|
355
|
-
fill_in "Card Code", with: '123'
|
356
|
-
|
357
|
-
expect {
|
358
|
-
click_on "Save and Continue"
|
359
|
-
}.to change { Spree::CreditCard.count }.by 1
|
360
|
-
|
361
|
-
expect(Spree::CreditCard.last.address).to be_present
|
362
|
-
|
372
|
+
click_on "Save and Continue"
|
363
373
|
click_on "Place Order"
|
364
374
|
expect(page).to have_current_path(spree.order_path(Spree::Order.last))
|
375
|
+
expect(page).to have_content('Ending in 1111')
|
365
376
|
end
|
366
377
|
end
|
367
378
|
|
@@ -498,7 +509,7 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
498
509
|
end
|
499
510
|
end
|
500
511
|
|
501
|
-
context "order has only payment step" do
|
512
|
+
context "order has only payment step", js: true do
|
502
513
|
before do
|
503
514
|
create(:credit_card_payment_method)
|
504
515
|
@old_checkout_flow = Spree::Order.checkout_flow
|
@@ -523,10 +534,7 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
523
534
|
expect(page).to have_current_path(spree.checkout_state_path('payment'))
|
524
535
|
|
525
536
|
choose "Credit Card"
|
526
|
-
|
527
|
-
fill_in "Card Number", with: '4111 1111 1111 1111'
|
528
|
-
fill_in "card_expiry", with: '04 / 20'
|
529
|
-
fill_in "Card Code", with: '123'
|
537
|
+
fill_in_credit_card
|
530
538
|
click_button "Save and Continue"
|
531
539
|
|
532
540
|
expect(current_path).to eq spree.checkout_state_path('confirm')
|
@@ -582,7 +590,7 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
582
590
|
end
|
583
591
|
|
584
592
|
it "displays a thank you message" do
|
585
|
-
expect(page).to have_content(I18n.t('spree.thank_you_for_your_order'))
|
593
|
+
expect(page).to have_content(I18n.t('spree.thank_you_for_your_order'), normalize_ws: true)
|
586
594
|
end
|
587
595
|
|
588
596
|
it "does not display a thank you message on that order future visits" do
|
@@ -657,16 +665,17 @@ describe "Checkout", type: :feature, inaccessible: true do
|
|
657
665
|
click_on "Save and Continue"
|
658
666
|
click_on "Save and Continue"
|
659
667
|
|
660
|
-
fill_in_credit_card
|
668
|
+
fill_in_credit_card
|
661
669
|
click_on "Save and Continue"
|
662
670
|
|
663
671
|
expect(page).to have_current_path("/checkout/confirm")
|
664
672
|
end
|
665
673
|
end
|
666
674
|
|
667
|
-
def fill_in_credit_card(number:)
|
668
|
-
fill_in "
|
669
|
-
|
675
|
+
def fill_in_credit_card(number: "4111 1111 1111 1111")
|
676
|
+
fill_in "Name on card", with: 'Mary Doe'
|
677
|
+
fill_in_with_force "Card Number", with: number
|
678
|
+
fill_in_with_force "Expiration", with: "12 / 24"
|
670
679
|
fill_in "Card Code", with: "123"
|
671
680
|
end
|
672
681
|
|
@@ -69,14 +69,14 @@ describe "Coupon code promotions", type: :feature, js: true do
|
|
69
69
|
expect(page).to have_content(I18n.t('spree.coupon_code_not_found'))
|
70
70
|
fill_in "order_coupon_code", with: "onetwo"
|
71
71
|
click_button "Apply Code"
|
72
|
-
expect(page).to have_content("Promotion (Onetwo)
|
72
|
+
expect(page).to have_content("Promotion (Onetwo) -$10.00", normalize_ws: true)
|
73
73
|
end
|
74
74
|
|
75
75
|
context "with a promotion" do
|
76
76
|
it "applies a promotion to an order" do
|
77
77
|
fill_in "order_coupon_code", with: "onetwo"
|
78
78
|
click_button "Apply Code"
|
79
|
-
expect(page).to have_content("Promotion (Onetwo)
|
79
|
+
expect(page).to have_content("Promotion (Onetwo) -$10.00", normalize_ws: true)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -202,7 +202,7 @@ describe "Coupon code promotions", type: :feature, js: true do
|
|
202
202
|
# 20% of $40 = 8
|
203
203
|
# 20% of $20 = 4
|
204
204
|
# Therefore: promotion discount amount is $12.
|
205
|
-
expect(page).to have_content("Promotion (Onetwo) -$12.00")
|
205
|
+
expect(page).to have_content("Promotion (Onetwo) -$12.00", normalize_ws: true)
|
206
206
|
end
|
207
207
|
|
208
208
|
within '.cart-total' do
|
@@ -241,7 +241,7 @@ describe "Coupon code promotions", type: :feature, js: true do
|
|
241
241
|
click_button "Apply Code"
|
242
242
|
|
243
243
|
within '#cart_adjustments' do
|
244
|
-
expect(page).to have_content("Promotion (Onetwo) -$30.00")
|
244
|
+
expect(page).to have_content("Promotion (Onetwo) -$30.00", normalize_ws: true)
|
245
245
|
end
|
246
246
|
|
247
247
|
within '.cart-total' do
|
@@ -253,7 +253,7 @@ describe "Coupon code promotions", type: :feature, js: true do
|
|
253
253
|
click_button "Update"
|
254
254
|
|
255
255
|
within '#cart_adjustments' do
|
256
|
-
expect(page).to have_content("Promotion (Onetwo) -$60.00")
|
256
|
+
expect(page).to have_content("Promotion (Onetwo) -$60.00", normalize_ws: true)
|
257
257
|
end
|
258
258
|
|
259
259
|
within '.cart-total' do
|
@@ -14,7 +14,7 @@ describe "Switching currencies in backend", type: :feature do
|
|
14
14
|
click_link "RoR Mug"
|
15
15
|
click_button "Add To Cart"
|
16
16
|
# Now that we have an order...
|
17
|
-
|
17
|
+
stub_spree_preferences(currency: "AUD")
|
18
18
|
visit spree.root_path
|
19
19
|
end
|
20
20
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.feature "First Order promotion" do
|
6
|
+
given!(:promotion) do
|
7
|
+
FactoryBot.create(
|
8
|
+
:promotion_with_first_order_rule,
|
9
|
+
:with_order_adjustment,
|
10
|
+
code: "FIRSTONEFREE",
|
11
|
+
per_code_usage_limit: 10
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
background do
|
16
|
+
create(:store)
|
17
|
+
product = FactoryBot.create(:product)
|
18
|
+
visit spree.root_path
|
19
|
+
click_link product.name
|
20
|
+
click_button "Add To Cart"
|
21
|
+
end
|
22
|
+
|
23
|
+
scenario "Adding first order promotion to cart and checking out as guest" do
|
24
|
+
fill_in "Coupon code", with: "FIRSTONEFREE"
|
25
|
+
click_button "Apply Code"
|
26
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
27
|
+
|
28
|
+
within("#cart_adjustments") do
|
29
|
+
expect(page).to have_content("-$10.00")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
scenario "Trying to reuse first order promotion" do
|
34
|
+
previous_user = FactoryBot.create(
|
35
|
+
:user,
|
36
|
+
email: "sam@tom.com"
|
37
|
+
)
|
38
|
+
_previous_order = create(:completed_order_with_totals, user: previous_user)
|
39
|
+
fill_in "Coupon code", with: "FIRSTONEFREE"
|
40
|
+
click_button "Apply Code"
|
41
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
42
|
+
click_on "Checkout"
|
43
|
+
fill_in "Customer E-Mail", with: "sam@tom.com"
|
44
|
+
fill_in_address
|
45
|
+
click_on "Save and Continue"
|
46
|
+
expect(page).to_not have_content("#summary-order-charges")
|
47
|
+
end
|
48
|
+
|
49
|
+
def fill_in_address
|
50
|
+
address = "order_bill_address_attributes"
|
51
|
+
fill_in "#{address}_firstname", with: "Ryan"
|
52
|
+
fill_in "#{address}_lastname", with: "Bigg"
|
53
|
+
fill_in "#{address}_address1", with: "143 Swan Street"
|
54
|
+
fill_in "#{address}_city", with: "Richmond"
|
55
|
+
select "United States of America", from: "#{address}_country_id"
|
56
|
+
fill_in "#{address}_zipcode", with: "12345"
|
57
|
+
fill_in "#{address}_phone", with: "(555) 555-5555"
|
58
|
+
end
|
59
|
+
end
|
@@ -52,8 +52,8 @@ describe "Free shipping promotions", type: :feature, js: true do
|
|
52
52
|
# Regression test for https://github.com/spree/spree/issues/4428
|
53
53
|
it "applies the free shipping promotion" do
|
54
54
|
within("#checkout-summary") do
|
55
|
-
expect(page).to have_content("Shipping total:
|
56
|
-
expect(page).to have_content("Promotion (Free Shipping): -$10.00")
|
55
|
+
expect(page).to have_content("Shipping total: $10.00", normalize_ws: true)
|
56
|
+
expect(page).to have_content("Promotion (Free Shipping): -$10.00", normalize_ws: true)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -6,11 +6,10 @@ describe 'setting locale', type: :feature do
|
|
6
6
|
let!(:store) { create(:store) }
|
7
7
|
def with_locale(locale)
|
8
8
|
I18n.locale = locale
|
9
|
-
Spree::Frontend::Config
|
9
|
+
stub_spree_preferences(Spree::Frontend::Config, locale: locale)
|
10
10
|
yield
|
11
11
|
ensure
|
12
12
|
I18n.locale = I18n.default_locale
|
13
|
-
Spree::Frontend::Config[:locale] = 'en'
|
14
13
|
end
|
15
14
|
|
16
15
|
context 'shopping cart link and page' do
|
@@ -93,7 +93,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
|
|
93
93
|
|
94
94
|
context "using Russian Rubles as a currency" do
|
95
95
|
before do
|
96
|
-
|
96
|
+
stub_spree_preferences(currency: "RUB")
|
97
97
|
end
|
98
98
|
|
99
99
|
let!(:product) do
|
@@ -199,8 +199,8 @@ describe "Visiting Products", type: :feature, inaccessible: true do
|
|
199
199
|
|
200
200
|
it "should be able to hide products without price" do
|
201
201
|
expect(page.all('ul.product-listing li').size).to eq(9)
|
202
|
-
|
203
|
-
|
202
|
+
stub_spree_preferences(show_products_without_price: false)
|
203
|
+
stub_spree_preferences(currency: "CAN")
|
204
204
|
visit spree.root_path
|
205
205
|
expect(page.all('ul.product-listing li').size).to eq(0)
|
206
206
|
end
|
@@ -224,7 +224,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
|
|
224
224
|
end
|
225
225
|
|
226
226
|
it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
|
227
|
-
|
227
|
+
stub_spree_preferences(products_per_page: 2)
|
228
228
|
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
229
229
|
check "Price_Range_$15.00_-_$18.00"
|
230
230
|
within(:css, '#sidebar_products_search') { click_button "Search" }
|
@@ -263,8 +263,8 @@ describe "Visiting Products", type: :feature, inaccessible: true do
|
|
263
263
|
|
264
264
|
it "shouldn't be able to put a product without a current price in the cart" do
|
265
265
|
product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
266
|
-
|
267
|
-
|
266
|
+
stub_spree_preferences(currency: "CAN")
|
267
|
+
stub_spree_preferences(show_products_without_price: true)
|
268
268
|
visit spree.product_path(product)
|
269
269
|
expect(page).to have_content "This product is not available in the selected currency."
|
270
270
|
expect(page).not_to have_content "add-to-cart-button"
|
@@ -272,8 +272,8 @@ describe "Visiting Products", type: :feature, inaccessible: true do
|
|
272
272
|
|
273
273
|
it "should be able to list products without a price" do
|
274
274
|
product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
275
|
-
|
276
|
-
|
275
|
+
stub_spree_preferences(currency: "CAN")
|
276
|
+
stub_spree_preferences(show_products_without_price: true)
|
277
277
|
visit spree.products_path
|
278
278
|
expect(page).to have_content(product.name)
|
279
279
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 2.9.2
|
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-
|
11
|
+
date: 2019-09-30 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.
|
19
|
+
version: 2.9.2
|
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.
|
26
|
+
version: 2.9.2
|
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.
|
33
|
+
version: 2.9.2
|
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.
|
40
|
+
version: 2.9.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: canonical-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- spec/features/checkout_unshippable_spec.rb
|
294
294
|
- spec/features/coupon_code_spec.rb
|
295
295
|
- spec/features/currency_spec.rb
|
296
|
+
- spec/features/first_order_promotion_spec.rb
|
296
297
|
- spec/features/free_shipping_promotions_spec.rb
|
297
298
|
- spec/features/locale_spec.rb
|
298
299
|
- spec/features/order_spec.rb
|
@@ -307,7 +308,6 @@ files:
|
|
307
308
|
- spec/helpers/order_helper_spec.rb
|
308
309
|
- spec/helpers/taxon_filters_helper_spec.rb
|
309
310
|
- spec/spec_helper.rb
|
310
|
-
- spec/support/features/fill_in_with_force.rb
|
311
311
|
- spec/support/shared_contexts/checkout_setup.rb
|
312
312
|
- spec/support/shared_contexts/custom_products.rb
|
313
313
|
- spec/support/shared_contexts/locales.rb
|
@@ -332,8 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
332
|
version: 1.8.23
|
333
333
|
requirements:
|
334
334
|
- none
|
335
|
-
|
336
|
-
rubygems_version: 2.7.3
|
335
|
+
rubygems_version: 3.0.6
|
337
336
|
signing_key:
|
338
337
|
specification_version: 4
|
339
338
|
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
|