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,36 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- # This spec is useful for when we just want to make sure a view is rendering correctly
5
- # Walking through the entire checkout process is rather tedious, don't you think?
6
- describe Spree::CheckoutController, type: :controller do
7
- render_views
8
- let(:token) { 'some_token' }
9
- let(:user) { stub_model(Spree::LegacyUser) }
10
-
11
- before do
12
- allow(controller).to receive_messages try_spree_current_user: user
13
- end
14
-
15
- # Regression test for #3246
16
- context "when using GBP" do
17
- before do
18
- Spree::Config[:currency] = "GBP"
19
- end
20
-
21
- context "when order is in delivery" do
22
- before do
23
- # Using a let block won't acknowledge the currency setting
24
- # Therefore we just do it like this...
25
- order = OrderWalkthrough.up_to(:delivery)
26
- allow(controller).to receive_messages current_order: order
27
- end
28
-
29
- it "displays rate cost in correct currency" do
30
- spree_get :edit
31
- html = Nokogiri::HTML(response.body)
32
- expect(html.css('.rate-cost').text).to eq "£10.00"
33
- end
34
- end
35
- end
36
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
- describe Spree::ContentController, type: :controller do
3
- it "should not display a local file" do
4
- spree_get :show, path: "../../Gemfile"
5
- expect(response.response_code).to eq(404)
6
- end
7
-
8
- it "should display CVV page" do
9
- spree_get :cvv
10
- expect(response.response_code).to eq(200)
11
- end
12
- end
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'current order tracking', type: :controller do
4
- let(:user) { create(:user) }
5
-
6
- controller(Spree::StoreController) do
7
- def index
8
- head :ok
9
- end
10
- end
11
-
12
- let(:order) { FactoryGirl.create(:order) }
13
-
14
- it 'automatically tracks who the order was created by & IP address' do
15
- allow(controller).to receive_messages(try_spree_current_user: user)
16
- get :index
17
- expect(controller.current_order(create_order_if_necessary: true).created_by).to eq controller.try_spree_current_user
18
- expect(controller.current_order.last_ip_address).to eq "0.0.0.0"
19
- end
20
-
21
- context "current order creation" do
22
- before { allow(controller).to receive_messages(try_spree_current_user: user) }
23
-
24
- it "doesn't create a new order out of the blue" do
25
- expect {
26
- spree_get :index
27
- }.not_to change { Spree::Order.count }
28
- end
29
- end
30
- end
31
-
32
- describe Spree::OrdersController, type: :controller do
33
- let(:user) { create(:user) }
34
-
35
- before { allow(controller).to receive_messages(try_spree_current_user: user) }
36
-
37
- describe Spree::OrdersController do
38
- it "doesn't create a new order out of the blue" do
39
- expect {
40
- spree_get :edit
41
- }.not_to change { Spree::Order.count }
42
- end
43
- end
44
- end
@@ -1,47 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::HomeController, type: :controller do
4
- it "provides current user to the searcher class" do
5
- user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
6
- allow(controller).to receive_messages try_spree_current_user: user
7
- expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
8
- spree_get :index
9
- expect(response.status).to eq(200)
10
- end
11
-
12
- context "layout" do
13
- it "renders default layout" do
14
- spree_get :index
15
- expect(response).to render_template(layout: 'spree/layouts/spree_application')
16
- end
17
-
18
- context "different layout specified in config" do
19
- before { Spree::Config.layout = 'layouts/application' }
20
-
21
- it "renders specified layout" do
22
- spree_get :index
23
- expect(response).to render_template(layout: 'layouts/application')
24
- end
25
- end
26
- end
27
-
28
- context "index products" do
29
- it "calls includes when the retrieved_products object responds to it" do
30
- searcher = double("Searcher")
31
- allow(controller).to receive_messages build_searcher: searcher
32
- expect(searcher).to receive_message_chain("retrieve_products.includes")
33
-
34
- spree_get :index
35
- end
36
-
37
- it "does not call includes when it's not available" do
38
- searcher = double("Searcher")
39
- allow(controller).to receive_messages build_searcher: searcher
40
- allow(searcher).to receive(:retrieve_products).and_return([])
41
-
42
- spree_get :index
43
-
44
- expect(assigns(:products)).to eq([])
45
- end
46
- end
47
- end
@@ -1,96 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Spree
4
- describe OrdersController, type: :controller do
5
- let(:user) { create(:user) }
6
- let(:guest_user) { create(:user) }
7
- let(:order) { Spree::Order.create }
8
-
9
- context 'when an order exists in the cookies.signed' do
10
- let(:token) { 'some_token' }
11
- let(:specified_order) { create(:order) }
12
-
13
- before do
14
- cookies.signed[:guest_token] = token
15
- allow(controller).to receive_messages current_order: order
16
- allow(controller).to receive_messages spree_current_user: user
17
- end
18
-
19
- context '#populate' do
20
- it 'should check if user is authorized for :edit' do
21
- expect(controller).to receive(:authorize!).with(:edit, order, token)
22
- spree_post :populate
23
- end
24
- it "should check against the specified order" do
25
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
26
- spree_post :populate, id: specified_order.number
27
- end
28
- end
29
-
30
- context '#edit' do
31
- it 'should check if user is authorized for :edit' do
32
- expect(controller).to receive(:authorize!).with(:edit, order, token)
33
- spree_get :edit
34
- end
35
- it "should check against the specified order" do
36
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
37
- spree_get :edit, id: specified_order.number
38
- end
39
- end
40
-
41
- context '#update' do
42
- it 'should check if user is authorized for :edit' do
43
- allow(order).to receive :update_attributes
44
- expect(controller).to receive(:authorize!).with(:edit, order, token)
45
- spree_post :update, order: { email: "foo@bar.com" }
46
- end
47
- it "should check against the specified order" do
48
- allow(order).to receive :update_attributes
49
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
50
- spree_post :update, order: { email: "foo@bar.com" }, id: specified_order.number
51
- end
52
- end
53
-
54
- context '#empty' do
55
- it 'should check if user is authorized for :edit' do
56
- expect(controller).to receive(:authorize!).with(:edit, order, token)
57
- spree_post :empty
58
- end
59
- it "should check against the specified order" do
60
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
61
- spree_post :empty, id: specified_order.number
62
- end
63
- end
64
-
65
- context "#show" do
66
- it "should check against the specified order" do
67
- expect(controller).to receive(:authorize!).with(:edit, specified_order, token)
68
- spree_get :show, id: specified_order.number
69
- end
70
- end
71
- end
72
-
73
- context 'when no authenticated user' do
74
- let(:order) { create(:order, number: 'R123') }
75
-
76
- context '#show' do
77
- context 'when guest_token correct' do
78
- before { cookies.signed[:guest_token] = order.guest_token }
79
-
80
- it 'displays the page' do
81
- expect(controller).to receive(:authorize!).with(:edit, order, order.guest_token)
82
- spree_get :show, { id: 'R123' }
83
- expect(response.code).to eq('200')
84
- end
85
- end
86
-
87
- context 'when guest_token not present' do
88
- it 'should respond with 404' do
89
- spree_get :show, { id: 'R123'}
90
- expect(response.code).to eq('404')
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
@@ -1,134 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::OrdersController, type: :controller do
4
- let(:user) { create(:user) }
5
-
6
- context "Order model mock" do
7
- let(:order) do
8
- Spree::Order.create!
9
- end
10
- let(:variant) { create(:variant) }
11
-
12
- before do
13
- allow(controller).to receive_messages(try_spree_current_user: user)
14
- end
15
-
16
- context "#populate" do
17
- it "should create a new order when none specified" do
18
- spree_post :populate, {}, {}
19
- expect(cookies.signed[:guest_token]).not_to be_blank
20
- expect(Spree::Order.find_by_guest_token(cookies.signed[:guest_token])).to be_persisted
21
- end
22
-
23
- context "with Variant" do
24
- it "should handle population" do
25
- expect do
26
- spree_post :populate, variant_id: variant.id, quantity: 5
27
- end.to change { user.orders.count }.by(1)
28
- order = user.orders.last
29
- expect(response).to redirect_to spree.cart_path
30
- expect(order.line_items.size).to eq(1)
31
- line_item = order.line_items.first
32
- expect(line_item.variant_id).to eq(variant.id)
33
- expect(line_item.quantity).to eq(5)
34
- end
35
-
36
- it "shows an error when population fails" do
37
- request.env["HTTP_REFERER"] = '/dummy_redirect'
38
- allow_any_instance_of(Spree::LineItem).to(
39
- receive(:valid?).and_return(false)
40
- )
41
- allow_any_instance_of(Spree::LineItem).to(
42
- receive_message_chain(:errors, :full_messages).
43
- and_return(["Order population failed"])
44
- )
45
-
46
- spree_post :populate, variant_id: variant.id, quantity: 5
47
-
48
- expect(response).to redirect_to('/dummy_redirect')
49
- expect(flash[:error]).to eq("Order population failed")
50
- end
51
-
52
- it "shows an error when quantity is invalid" do
53
- request.env["HTTP_REFERER"] = '/dummy_redirect'
54
-
55
- spree_post(
56
- :populate,
57
- variant_id: variant.id, quantity: -1
58
- )
59
-
60
- expect(response).to redirect_to('/dummy_redirect')
61
- expect(flash[:error]).to eq(
62
- Spree.t(:please_enter_reasonable_quantity)
63
- )
64
- end
65
- end
66
- end
67
-
68
- context "#update" do
69
- context "with authorization" do
70
- before do
71
- allow(controller).to receive :check_authorization
72
- allow(controller).to receive_messages current_order: order
73
- end
74
-
75
- it "should render the edit view (on failure)" do
76
- # email validation is only after address state
77
- order.update_column(:state, "delivery")
78
- spree_put :update, { order: { email: "" } }, { order_id: order.id }
79
- expect(response).to render_template :edit
80
- end
81
-
82
- it "should redirect to cart path (on success)" do
83
- allow(order).to receive(:update_attributes).and_return true
84
- spree_put :update, {}, {order_id: 1}
85
- expect(response).to redirect_to(spree.cart_path)
86
- end
87
- end
88
- end
89
-
90
- context "#empty" do
91
- before do
92
- allow(controller).to receive :check_authorization
93
- end
94
-
95
- it "should destroy line items in the current order" do
96
- allow(controller).to receive(:current_order).and_return(order)
97
- expect(order).to receive(:empty!)
98
- spree_put :empty
99
- expect(response).to redirect_to(spree.cart_path)
100
- end
101
- end
102
-
103
- # Regression test for #2750
104
- context "#update" do
105
- before do
106
- allow(user).to receive :last_incomplete_spree_order
107
- allow(controller).to receive :set_current_order
108
- end
109
-
110
- it "cannot update a blank order" do
111
- spree_put :update, order: { email: "foo" }
112
- expect(flash[:error]).to eq(Spree.t(:order_not_found))
113
- expect(response).to redirect_to(spree.root_path)
114
- end
115
- end
116
- end
117
-
118
- context "line items quantity is 0" do
119
- let(:order) { Spree::Order.create }
120
- let(:variant) { create(:variant) }
121
- let!(:line_item) { order.contents.add(variant, 1) }
122
-
123
- before do
124
- allow(controller).to receive(:check_authorization)
125
- allow(controller).to receive_messages(current_order: order)
126
- end
127
-
128
- it "removes line items on update" do
129
- expect(order.line_items.count).to eq 1
130
- spree_put :update, order: { line_items_attributes: { "0" => { id: line_item.id, quantity: 0 } } }
131
- expect(order.reload.line_items.count).to eq 0
132
- end
133
- end
134
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
-
3
- Spree::Order.class_eval do
4
- attr_accessor :did_transition
5
- end
6
-
7
- module Spree
8
- describe OrdersController, type: :controller do
9
- # Regression test for #2004
10
- context "with a transition callback on first state" do
11
- let(:order) { Spree::Order.new }
12
-
13
- before do
14
- allow(controller).to receive_messages current_order: order
15
- expect(controller).to receive(:authorize!).at_least(:once).and_return(true)
16
-
17
- first_state, _ = Spree::Order.checkout_steps.first
18
- Spree::Order.state_machine.after_transition to: first_state do |order|
19
- order.did_transition = true
20
- end
21
- end
22
-
23
- it "correctly calls the transition callback" do
24
- expect(order.did_transition).to be_nil
25
- order.line_items << FactoryGirl.create(:line_item)
26
- spree_put :update, { checkout: "checkout" }, { order_id: 1}
27
- expect(order.did_transition).to be true
28
- end
29
- end
30
- end
31
- end
@@ -1,87 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::ProductsController, type: :controller do
4
- let!(:product) { create(:product, available_on: 1.year.from_now) }
5
- let(:taxon) { create(:taxon) }
6
-
7
- # Regression test for #1390
8
- it "allows admins to view non-active products" do
9
- allow(controller).to receive_messages spree_current_user: mock_model(Spree.user_class, has_spree_role?: true, last_incomplete_spree_order: nil, spree_api_key: 'fake')
10
- spree_get :show, id: product.to_param
11
- expect(response.status).to eq(200)
12
- end
13
-
14
- it "cannot view non-active products" do
15
- spree_get :show, id: product.to_param
16
- expect(response.status).to eq(404)
17
- end
18
-
19
- it "should provide the current user to the searcher class" do
20
- user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
21
- allow(controller).to receive_messages spree_current_user: user
22
- expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
23
- spree_get :index
24
- expect(response.status).to eq(200)
25
- end
26
-
27
- # Regression test for #2249
28
- it "doesn't error when given an invalid referer" do
29
- current_user = mock_model(Spree.user_class, has_spree_role?: true, last_incomplete_spree_order: nil, generate_spree_api_key!: nil)
30
- allow(controller).to receive_messages spree_current_user: current_user
31
- request.env['HTTP_REFERER'] = "not|a$url"
32
-
33
- # Previously a URI::InvalidURIError exception was being thrown
34
- expect { spree_get :show, id: product.to_param }.not_to raise_error
35
- end
36
-
37
- context 'with history slugs present' do
38
- let!(:product) { create(:product, available_on: 1.day.ago) }
39
-
40
- it 'will redirect with a 301 with legacy url used' do
41
- legacy_params = product.to_param
42
- product.name = product.name + " Brand New"
43
- product.slug = nil
44
- product.save!
45
- spree_get :show, id: legacy_params
46
- expect(response.status).to eq(301)
47
- end
48
-
49
- it 'will redirect with a 301 with id used' do
50
- product.name = product.name + " Brand New"
51
- product.slug = nil
52
- product.save!
53
- spree_get :show, id: product.id
54
- expect(response.status).to eq(301)
55
- end
56
-
57
- it "will keep url params on legacy url redirect" do
58
- legacy_params = product.to_param
59
- product.name = product.name + " Brand New"
60
- product.slug = nil
61
- product.save!
62
- spree_get :show, id: legacy_params, taxon_id: taxon.id
63
- expect(response.status).to eq(301)
64
- expect(response.header["Location"]).to include("taxon_id=#{taxon.id}")
65
- end
66
- end
67
-
68
- context "index products" do
69
- it "calls includes when the retrieved_products object responds to it" do
70
- searcher = double("Searcher")
71
- allow(controller).to receive_messages build_searcher: searcher
72
- expect(searcher).to receive_message_chain("retrieve_products.includes")
73
-
74
- spree_get :index
75
- end
76
-
77
- it "does not call includes when it's not available" do
78
- searcher = double("Searcher")
79
- allow(controller).to receive_messages build_searcher: searcher
80
- allow(searcher).to receive(:retrieve_products).and_return([])
81
-
82
- spree_get :index
83
-
84
- expect(assigns(:products)).to eq([])
85
- end
86
- end
87
- end