solidus_frontend 2.6.5 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solidus_frontend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +2 -1
- data/app/assets/stylesheets/spree/frontend/screen.css.scss +39 -1
- data/app/controllers/spree/checkout_controller.rb +61 -3
- data/app/controllers/spree/coupon_codes_controller.rb +35 -0
- data/app/controllers/spree/locale_controller.rb +1 -1
- data/app/controllers/spree/orders_controller.rb +27 -12
- data/app/controllers/spree/store_controller.rb +0 -18
- data/app/controllers/spree/taxons_controller.rb +6 -3
- data/app/views/spree/checkout/_coupon_code.html.erb +12 -0
- data/app/views/spree/checkout/_delivery.html.erb +6 -2
- data/app/views/spree/checkout/_payment.html.erb +0 -10
- data/app/views/spree/checkout/_summary.html.erb +4 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +6 -5
- data/app/views/spree/coupon_codes/new.html.erb +6 -0
- data/app/views/spree/orders/_form.html.erb +1 -1
- data/app/views/spree/orders/_line_item.html.erb +3 -5
- data/app/views/spree/orders/edit.html.erb +5 -6
- data/app/views/spree/products/_image.html.erb +4 -1
- data/app/views/spree/products/_thumbnails.html.erb +10 -8
- data/app/views/spree/shared/_image.html.erb +4 -4
- data/app/views/spree/shared/_locale_selector.html.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +3 -5
- data/app/views/spree/shared/_products.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/spree/frontend.rb +1 -1
- data/solidus_frontend.gemspec +1 -1
- data/spec/controllers/spree/checkout_controller_spec.rb +109 -9
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +1 -1
- data/spec/controllers/spree/home_controller_spec.rb +1 -1
- data/spec/controllers/spree/orders_controller_ability_spec.rb +11 -30
- data/spec/controllers/spree/orders_controller_spec.rb +54 -3
- data/spec/controllers/spree/products_controller_spec.rb +3 -3
- data/spec/controllers/spree/taxons_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_confirm_insufficient_stock_spec.rb +71 -0
- data/spec/features/checkout_spec.rb +34 -25
- data/spec/features/coupon_code_spec.rb +96 -56
- 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/products_spec.rb +8 -8
- data/spec/features/promotion_code_invalidation_spec.rb +2 -2
- data/spec/features/quantity_promotions_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -1
- metadata +14 -9
- data/spec/support/features/fill_in_with_force.rb +0 -12
@@ -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
|
@@ -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
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.feature "Promotion Code Invalidation" do
|
5
|
+
RSpec.feature "Promotion Code Invalidation", js: true do
|
6
6
|
given!(:promotion) do
|
7
7
|
FactoryBot.create(
|
8
8
|
:promotion_with_item_adjustment,
|
@@ -28,7 +28,7 @@ RSpec.feature "Promotion Code Invalidation" do
|
|
28
28
|
|
29
29
|
scenario "adding the promotion to a cart with two applicable items" do
|
30
30
|
fill_in "Coupon code", with: "PROMO"
|
31
|
-
click_button "
|
31
|
+
click_button "Apply Code"
|
32
32
|
|
33
33
|
expect(page).to have_content("The coupon code was successfully applied to your order")
|
34
34
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
RSpec.feature "Quantity Promotions" do
|
5
|
+
RSpec.feature "Quantity Promotions", js: true do
|
6
6
|
given(:action) do
|
7
7
|
Spree::Promotion::Actions::CreateQuantityAdjustments.create(
|
8
8
|
calculator: calculator,
|
@@ -26,8 +26,8 @@ RSpec.feature "Quantity Promotions" do
|
|
26
26
|
|
27
27
|
scenario "adding and removing items from the cart" do
|
28
28
|
# Attempt to use the code with too few items.
|
29
|
-
fill_in "
|
30
|
-
click_button "
|
29
|
+
fill_in "coupon_code", with: "PROMO"
|
30
|
+
click_button "Apply Code"
|
31
31
|
expect(page).to have_content("This coupon code could not be applied to the cart at this time")
|
32
32
|
|
33
33
|
# Add another item to our cart.
|
@@ -36,8 +36,8 @@ RSpec.feature "Quantity Promotions" do
|
|
36
36
|
click_button "Add To Cart"
|
37
37
|
|
38
38
|
# Using the code should now succeed.
|
39
|
-
fill_in "
|
40
|
-
click_button "
|
39
|
+
fill_in "coupon_code", with: "PROMO"
|
40
|
+
click_button "Apply Code"
|
41
41
|
expect(page).to have_content("The coupon code was successfully applied to your order")
|
42
42
|
within("#cart_adjustments") do
|
43
43
|
expect(page).to have_content("-$10.00")
|
@@ -70,8 +70,8 @@ RSpec.feature "Quantity Promotions" do
|
|
70
70
|
click_button "Update"
|
71
71
|
|
72
72
|
# Apply the promo code and see a $10 discount (for 2 of the 3 items)
|
73
|
-
fill_in "
|
74
|
-
click_button "
|
73
|
+
fill_in "coupon_code", with: "PROMO"
|
74
|
+
click_button "Apply Code"
|
75
75
|
expect(page).to have_content("The coupon code was successfully applied to your order")
|
76
76
|
within("#cart_adjustments") do
|
77
77
|
expect(page).to have_content("-$10.00")
|
@@ -104,8 +104,8 @@ RSpec.feature "Quantity Promotions" do
|
|
104
104
|
click_button "Update"
|
105
105
|
|
106
106
|
# Apply the promo code and see a $15 discount
|
107
|
-
fill_in "
|
108
|
-
click_button "
|
107
|
+
fill_in "coupon_code", with: "PROMO"
|
108
|
+
click_button "Apply Code"
|
109
109
|
expect(page).to have_content("The coupon code was successfully applied to your order")
|
110
110
|
within("#cart_adjustments") do
|
111
111
|
expect(page).to have_content("-$15.00")
|
data/spec/spec_helper.rb
CHANGED
@@ -26,6 +26,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
26
26
|
|
27
27
|
require 'database_cleaner'
|
28
28
|
|
29
|
+
require 'spree/testing_support/partial_double_verification'
|
29
30
|
require 'spree/testing_support/authorization_helpers'
|
30
31
|
require 'spree/testing_support/capybara_ext'
|
31
32
|
require 'spree/testing_support/factories'
|
@@ -74,7 +75,6 @@ RSpec.configure do |config|
|
|
74
75
|
|
75
76
|
config.before(:each) do
|
76
77
|
Rails.cache.clear
|
77
|
-
reset_spree_preferences
|
78
78
|
end
|
79
79
|
|
80
80
|
config.before(:each, type: :feature) do
|
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.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-
|
11
|
+
date: 2019-07-16 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.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.
|
26
|
+
version: 2.9.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.
|
33
|
+
version: 2.9.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.
|
40
|
+
version: 2.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: canonical-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: sassc-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- app/assets/stylesheets/spree/frontend/screen.css.scss
|
196
196
|
- app/controllers/spree/checkout_controller.rb
|
197
197
|
- app/controllers/spree/content_controller.rb
|
198
|
+
- app/controllers/spree/coupon_codes_controller.rb
|
198
199
|
- app/controllers/spree/home_controller.rb
|
199
200
|
- app/controllers/spree/locale_controller.rb
|
200
201
|
- app/controllers/spree/orders_controller.rb
|
@@ -208,6 +209,7 @@ files:
|
|
208
209
|
- app/views/spree/address/_form_hidden.html.erb
|
209
210
|
- app/views/spree/checkout/_address.html.erb
|
210
211
|
- app/views/spree/checkout/_confirm.html.erb
|
212
|
+
- app/views/spree/checkout/_coupon_code.html.erb
|
211
213
|
- app/views/spree/checkout/_delivery.html.erb
|
212
214
|
- app/views/spree/checkout/_payment.html.erb
|
213
215
|
- app/views/spree/checkout/_summary.html.erb
|
@@ -217,6 +219,7 @@ files:
|
|
217
219
|
- app/views/spree/checkout/payment/_check.html.erb
|
218
220
|
- app/views/spree/checkout/payment/_gateway.html.erb
|
219
221
|
- app/views/spree/content/cvv.html.erb
|
222
|
+
- app/views/spree/coupon_codes/new.html.erb
|
220
223
|
- app/views/spree/home/index.html.erb
|
221
224
|
- app/views/spree/layouts/spree_application.html.erb
|
222
225
|
- app/views/spree/orders/_adjustment_row.html.erb
|
@@ -285,10 +288,12 @@ files:
|
|
285
288
|
- spec/features/caching/products_spec.rb
|
286
289
|
- spec/features/caching/taxons_spec.rb
|
287
290
|
- spec/features/cart_spec.rb
|
291
|
+
- spec/features/checkout_confirm_insufficient_stock_spec.rb
|
288
292
|
- spec/features/checkout_spec.rb
|
289
293
|
- spec/features/checkout_unshippable_spec.rb
|
290
294
|
- spec/features/coupon_code_spec.rb
|
291
295
|
- spec/features/currency_spec.rb
|
296
|
+
- spec/features/first_order_promotion_spec.rb
|
292
297
|
- spec/features/free_shipping_promotions_spec.rb
|
293
298
|
- spec/features/locale_spec.rb
|
294
299
|
- spec/features/order_spec.rb
|
@@ -303,7 +308,6 @@ files:
|
|
303
308
|
- spec/helpers/order_helper_spec.rb
|
304
309
|
- spec/helpers/taxon_filters_helper_spec.rb
|
305
310
|
- spec/spec_helper.rb
|
306
|
-
- spec/support/features/fill_in_with_force.rb
|
307
311
|
- spec/support/shared_contexts/checkout_setup.rb
|
308
312
|
- spec/support/shared_contexts/custom_products.rb
|
309
313
|
- spec/support/shared_contexts/locales.rb
|
@@ -328,7 +332,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
332
|
version: 1.8.23
|
329
333
|
requirements:
|
330
334
|
- none
|
331
|
-
|
335
|
+
rubyforge_project:
|
336
|
+
rubygems_version: 2.7.3
|
332
337
|
signing_key:
|
333
338
|
specification_version: 4
|
334
339
|
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
|