spree_frontend 3.2.1 → 3.2.2

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/spree_frontend.gemspec +2 -3
  3. metadata +10 -86
  4. data/spec/controllers/controller_extension_spec.rb +0 -126
  5. data/spec/controllers/controller_helpers_spec.rb +0 -122
  6. data/spec/controllers/spree/checkout_controller_spec.rb +0 -515
  7. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
  8. data/spec/controllers/spree/content_controller_spec.rb +0 -12
  9. data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
  10. data/spec/controllers/spree/home_controller_spec.rb +0 -47
  11. data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -96
  12. data/spec/controllers/spree/orders_controller_spec.rb +0 -134
  13. data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -31
  14. data/spec/controllers/spree/products_controller_spec.rb +0 -87
  15. data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
  16. data/spec/features/address_spec.rb +0 -93
  17. data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
  18. data/spec/features/caching/products_spec.rb +0 -59
  19. data/spec/features/caching/taxons_spec.rb +0 -22
  20. data/spec/features/cart_spec.rb +0 -132
  21. data/spec/features/checkout_spec.rb +0 -572
  22. data/spec/features/checkout_unshippable_spec.rb +0 -34
  23. data/spec/features/coupon_code_spec.rb +0 -88
  24. data/spec/features/currency_spec.rb +0 -18
  25. data/spec/features/delivery_spec.rb +0 -64
  26. data/spec/features/free_shipping_promotions_spec.rb +0 -59
  27. data/spec/features/locale_spec.rb +0 -60
  28. data/spec/features/microdata_spec.rb +0 -0
  29. data/spec/features/order_spec.rb +0 -107
  30. data/spec/features/page_promotions_spec.rb +0 -36
  31. data/spec/features/products_spec.rb +0 -334
  32. data/spec/features/taxons_spec.rb +0 -147
  33. data/spec/features/template_rendering_spec.rb +0 -19
  34. data/spec/fixtures/thinking-cat.jpg +0 -0
  35. data/spec/helpers/frontend_helper_spec.rb +0 -57
  36. data/spec/helpers/taxons_helper_spec.rb +0 -17
  37. data/spec/spec_helper.rb +0 -126
  38. data/spec/support/shared_contexts/checkout_setup.rb +0 -10
  39. data/spec/support/shared_contexts/custom_products.rb +0 -25
  40. data/spec/support/shared_contexts/product_prototypes.rb +0 -30
  41. data/spec/views/spree/checkout/_summary_spec.rb +0 -11
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "checkout with unshippable items", type: :feature, inaccessible: true do
4
- let!(:stock_location) { create(:stock_location) }
5
- let(:order) { OrderWalkthrough.up_to(:delivery) }
6
-
7
- before do
8
- OrderWalkthrough.add_line_item!(order)
9
- line_item = order.line_items.last
10
- stock_item = stock_location.stock_item(line_item.variant)
11
- stock_item.adjust_count_on_hand -999
12
- stock_item.backorderable = false
13
- stock_item.save!
14
-
15
- user = create(:user)
16
- order.user = user
17
- order.update_with_updater!
18
-
19
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
20
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
21
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(skip_state_validation?: true)
22
- allow_any_instance_of(Spree::CheckoutController).to receive_messages(ensure_sufficient_stock_lines: true)
23
- end
24
-
25
- it 'displays and removes' do
26
- visit spree.checkout_state_path(:delivery)
27
- expect(page).to have_content('Unshippable Items')
28
-
29
- click_button "Save and Continue"
30
-
31
- order.reload
32
- expect(order.line_items.count).to eq 1
33
- end
34
- end
@@ -1,88 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Coupon code 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
- let!(:store) { create(:store) }
11
-
12
- context "visitor makes checkout as guest without registration" do
13
- def create_basic_coupon_promotion(code)
14
- promotion = Spree::Promotion.create!(name: code.titleize,
15
- code: code,
16
- starts_at: 1.day.ago,
17
- expires_at: 1.day.from_now)
18
-
19
- calculator = Spree::Calculator::FlatRate.new
20
- calculator.preferred_amount = 10
21
-
22
- action = Spree::Promotion::Actions::CreateItemAdjustments.new
23
- action.calculator = calculator
24
- action.promotion = promotion
25
- action.save
26
-
27
- promotion.reload # so that promotion.actions is available
28
- end
29
-
30
- let!(:promotion) { create_basic_coupon_promotion("onetwo") }
31
-
32
- # OrdersController
33
- context "on the payment page" do
34
- before do
35
- visit spree.root_path
36
- click_link "RoR Mug"
37
- click_button "add-to-cart-button"
38
- click_button "Checkout"
39
- fill_in "order_email", with: "spree@example.com"
40
- fill_in "First Name", with: "John"
41
- fill_in "Last Name", with: "Smith"
42
- fill_in "Street Address", with: "1 John Street"
43
- fill_in "City", with: "City of John"
44
- fill_in "Zip", with: "01337"
45
- select country.name, from: "Country"
46
- select state.name, from: "order[bill_address_attributes][state_id]"
47
- fill_in "Phone", with: "555-555-5555"
48
-
49
- # To shipping method screen
50
- click_button "Save and Continue"
51
- # To payment screen
52
- click_button "Save and Continue"
53
- end
54
-
55
- it "informs about an invalid coupon code" do
56
- fill_in "order_coupon_code", with: "coupon_codes_rule_man"
57
- click_button "Save and Continue"
58
- expect(page).to have_content(Spree.t(:coupon_code_not_found))
59
- end
60
-
61
- it "informs the user about a coupon code which has exceeded its usage" do
62
- promotion.update_column(:usage_limit, 5)
63
- allow_any_instance_of(promotion.class).to receive_messages(credits_count: 10)
64
-
65
- fill_in "order_coupon_code", with: "onetwo"
66
- click_button "Save and Continue"
67
- expect(page).to have_content(Spree.t(:coupon_code_max_usage))
68
- end
69
-
70
- it "can enter an invalid coupon code, then a real one" do
71
- fill_in "order_coupon_code", with: "coupon_codes_rule_man"
72
- click_button "Save and Continue"
73
- expect(page).to have_content(Spree.t(:coupon_code_not_found))
74
- fill_in "order_coupon_code", with: "onetwo"
75
- click_button "Save and Continue"
76
- expect(page).to have_content("Promotion (Onetwo) -$10.00")
77
- end
78
-
79
- context "with a promotion" do
80
- it "applies a promotion to an order" do
81
- fill_in "order_coupon_code", with: "onetwo"
82
- click_button "Save and Continue"
83
- expect(page).to have_content("Promotion (Onetwo) -$10.00")
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Switching currencies in backend", type: :feature do
4
- before do
5
- create(:base_product, name: "RoR Mug")
6
- end
7
-
8
- # Regression test for #2340
9
- it "does not cause current_order to become nil", inaccessible: true do
10
- visit spree.root_path
11
- click_link "RoR Mug"
12
- click_button "Add To Cart"
13
- # Now that we have an order...
14
- Spree::Config[:currency] = "AUD"
15
- expect { visit spree.root_path }.not_to raise_error
16
- end
17
-
18
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Delivery', 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
- let!(:product2) { create(:product) }
9
- let(:user) { create(:user) }
10
- let!(:shipping_method2) do
11
- sm = create(:shipping_method, name: 'Shipping Method2')
12
- sm.calculator.preferred_amount = 20
13
- sm.calculator.save
14
- sm
15
- end
16
-
17
- before do
18
- shipping_method.calculator.preferred_amount = 10
19
- shipping_method.calculator.save
20
- end
21
-
22
- describe 'shipping total gets updated when shipping method is changed in the delivery step' do
23
- before do
24
- add_mug_to_cart
25
- click_button 'Checkout'
26
-
27
- fill_in 'order_email', with: 'test@example.com'
28
- click_on 'Continue'
29
- fill_in_address
30
-
31
- click_button 'Save and Continue'
32
- end
33
-
34
- it 'should contain the shipping total' do
35
- expect(page).to have_content('Shipping total: $10.00')
36
- end
37
-
38
- context 'shipping method is changed' do
39
- before { choose(shipping_method2.name) }
40
-
41
- it 'shipping total and order total both are updates' do
42
- expect(page).to have_content("Shipping total: $20.00")
43
- end
44
- end
45
- end
46
-
47
- def fill_in_address
48
- address = "order_bill_address_attributes"
49
- fill_in "#{address}_firstname", with: FFaker::Name.first_name
50
- fill_in "#{address}_lastname", with: FFaker::Name.last_name
51
- fill_in "#{address}_address1", with: FFaker::Address.street_address
52
- fill_in "#{address}_city", with: FFaker::Address.city
53
- select country.name, from: "#{address}_country_id"
54
- select state.name, from: "#{address}_state_id"
55
- fill_in "#{address}_zipcode", with: FFaker::AddressUS.zip_code
56
- fill_in "#{address}_phone", with: FFaker::PhoneNumber.phone_number
57
- end
58
-
59
- def add_mug_to_cart
60
- visit spree.root_path
61
- click_link mug.name
62
- click_button "add-to-cart-button"
63
- end
64
- end
@@ -1,59 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Free shipping 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) do
8
- sm = create(:shipping_method)
9
- sm.calculator.preferred_amount = 10
10
- sm.calculator.save
11
- sm
12
- end
13
-
14
- let!(:payment_method) { create(:check_payment_method) }
15
- let!(:product) { create(:product, name: "RoR Mug", price: 20) }
16
- let!(:promotion) do
17
- promotion = Spree::Promotion.create!(name: "Free Shipping",
18
- starts_at: 1.day.ago,
19
- expires_at: 1.day.from_now)
20
-
21
- action = Spree::Promotion::Actions::FreeShipping.new
22
- action.promotion = promotion
23
- action.save
24
-
25
- promotion.reload # so that promotion.actions is available
26
- end
27
-
28
- context "free shipping promotion automatically applied" do
29
- before do
30
-
31
- visit spree.root_path
32
- click_link "RoR Mug"
33
- click_button "add-to-cart-button"
34
- click_button "Checkout"
35
- fill_in "order_email", with: "spree@example.com"
36
- fill_in "First Name", with: "John"
37
- fill_in "Last Name", with: "Smith"
38
- fill_in "Street Address", with: "1 John Street"
39
- fill_in "City", with: "City of John"
40
- fill_in "Zip", with: "01337"
41
- select country.name, from: "Country"
42
- select state.name, from: "order[bill_address_attributes][state_id]"
43
- fill_in "Phone", with: "555-555-5555"
44
-
45
- # To shipping method screen
46
- click_button "Save and Continue"
47
- # To payment screen
48
- click_button "Save and Continue"
49
- end
50
-
51
- # Regression test for #4428
52
- it "applies the free shipping promotion" do
53
- within("#checkout-summary") do
54
- expect(page).to have_content("Shipping total: $10.00")
55
- expect(page).to have_content("Promotion (Free Shipping): -$10.00")
56
- end
57
- end
58
- end
59
- end
@@ -1,60 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'setting locale', type: :feature do
4
- def with_locale(locale)
5
- I18n.locale = locale
6
- Spree::Frontend::Config[:locale] = locale
7
- yield
8
- I18n.locale = 'en'
9
- Spree::Frontend::Config[:locale] = 'en'
10
- end
11
-
12
- context 'shopping cart link and page' do
13
- before do
14
- I18n.backend.store_translations(:fr,
15
- spree: {
16
- cart: 'Panier',
17
- shopping_cart: 'Panier'
18
- })
19
- end
20
-
21
- it 'should be in french' do
22
- with_locale('fr') do
23
- visit spree.root_path
24
- click_link 'Panier'
25
- expect(page).to have_content('Panier')
26
- end
27
- end
28
- end
29
-
30
- context 'checkout form validation messages' do
31
- include_context 'checkout setup'
32
-
33
- let(:error_messages) do
34
- {
35
- 'en' => 'This field is required.',
36
- 'fr' => 'Ce champ est obligatoire.',
37
- 'de' => 'Dieses Feld ist ein Pflichtfeld.',
38
- }
39
- end
40
-
41
- def check_error_text(text)
42
- %w(firstname lastname address1 city).each do |attr|
43
- expect(find("#b#{attr} label.error").text).to eq(text)
44
- end
45
- end
46
-
47
- it 'shows translated jquery.validate error messages', js: true do
48
- visit spree.root_path
49
- click_link mug.name
50
- click_button 'add-to-cart-button'
51
- error_messages.each do |locale, message|
52
- with_locale(locale) do
53
- visit '/checkout/address'
54
- find('.form-buttons input[type=submit]').click
55
- check_error_text message
56
- end
57
- end
58
- end
59
- end
60
- end
File without changes
@@ -1,107 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'orders', type: :feature do
4
- let(:order) { OrderWalkthrough.up_to(:complete) }
5
- let(:user) { create(:user) }
6
-
7
- before do
8
- order.update_attribute(:user_id, user.id)
9
- order.shipments.destroy_all
10
- allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
11
- end
12
-
13
- it "can visit an order" do
14
- # Regression test for current_user call on orders/show
15
- expect { visit spree.order_path(order) }.not_to raise_error
16
- end
17
-
18
- it "should display line item price" do
19
- # Regression test for #2772
20
- line_item = order.line_items.first
21
- line_item.target_shipment = create(:shipment)
22
- line_item.price = 19.00
23
- line_item.save!
24
-
25
- visit spree.order_path(order)
26
-
27
- # Tests view spree/shared/_order_details
28
- within 'td.price' do
29
- expect(page).to have_content "19.00"
30
- end
31
- end
32
-
33
- it "should have credit card info if paid with credit card" do
34
- create(:payment, order: order)
35
- visit spree.order_path(order)
36
- within '.payment-info' do
37
- expect(page).to have_content "Ending in 1111"
38
- end
39
- end
40
-
41
- it "should have payment method name visible if not paid with credit card" do
42
- create(:check_payment, order: order)
43
- visit spree.order_path(order)
44
- within '.payment-info' do
45
- expect(page).to have_content "Check"
46
- end
47
- end
48
-
49
- # Regression test for #2282
50
- context "can support a credit card with blank information" do
51
- before do
52
- credit_card = create(:credit_card)
53
- credit_card.update_column(:cc_type, '')
54
- payment = order.payments.first
55
- payment.source = credit_card
56
- payment.save!
57
- end
58
-
59
- specify do
60
- visit spree.order_path(order)
61
- within '.payment-info' do
62
- expect { find("img") }.to raise_error(Capybara::ElementNotFound)
63
- end
64
- end
65
- end
66
-
67
- it "should return the correct title when displaying a completed order" do
68
- visit spree.order_path(order)
69
-
70
- within '#order_summary' do
71
- expect(page).to have_content("#{Spree.t(:order)} #{order.number}")
72
- end
73
- end
74
-
75
- # Regression test for #6733
76
- context "address_requires_state preference" do
77
- context "when set to true" do
78
- before do
79
- configure_spree_preferences { |config| config.address_requires_state = true }
80
- end
81
-
82
- it "should show state text" do
83
- visit spree.order_path(order)
84
-
85
- within '#order' do
86
- expect(page).to have_content(order.bill_address.state_text)
87
- expect(page).to have_content(order.ship_address.state_text)
88
- end
89
- end
90
- end
91
-
92
- context "when set to false" do
93
- before do
94
- configure_spree_preferences { |config| config.address_requires_state = false }
95
- end
96
-
97
- it "should not show state text" do
98
- visit spree.order_path(order)
99
-
100
- within '#order' do
101
- expect(page).not_to have_content(order.bill_address.state_text)
102
- expect(page).not_to have_content(order.ship_address.state_text)
103
- end
104
- end
105
- end
106
- end
107
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'page promotions', type: :feature do
4
- let!(:product) { create(:product, name: "RoR Mug", price: 20) }
5
- before do
6
- promotion = Spree::Promotion.create!(name: "$10 off",
7
- path: 'test',
8
- starts_at: 1.day.ago,
9
- expires_at: 1.day.from_now)
10
-
11
- calculator = Spree::Calculator::FlatRate.new
12
- calculator.preferred_amount = 10
13
-
14
- action = Spree::Promotion::Actions::CreateItemAdjustments.create(calculator: calculator)
15
- promotion.actions << action
16
-
17
- visit spree.root_path
18
- click_link "RoR Mug"
19
- click_button "add-to-cart-button"
20
- end
21
-
22
- it "automatically applies a page promotion upon visiting" do
23
- expect(page).not_to have_content("Promotion ($10 off) -$10.00")
24
- visit '/content/test'
25
- visit '/cart'
26
- expect(page).to have_content("Promotion ($10 off) -$10.00")
27
- expect(page).to have_content("Subtotal (1 item) $20.00")
28
- end
29
-
30
- it "does not activate an adjustment for a path that doesn't have a promotion" do
31
- expect(page).not_to have_content("Promotion ($10 off) -$10.00")
32
- visit '/content/cvv'
33
- visit '/cart'
34
- expect(page).not_to have_content("Promotion ($10 off) -$10.00")
35
- end
36
- end