spree_frontend 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
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,334 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe "Visiting Products", type: :feature, inaccessible: true do
5
- include_context "custom products"
6
-
7
- let(:store_name) do
8
- ((first_store = Spree::Store.first) && first_store.name).to_s
9
- end
10
-
11
- before(:each) do
12
- visit spree.root_path
13
- end
14
-
15
- it "should be able to show the shopping cart after adding a product to it" do
16
- click_link "Ruby on Rails Ringer T-Shirt"
17
- expect(page).to have_content("$19.99")
18
-
19
- click_button 'add-to-cart-button'
20
- expect(page).to have_content("Shopping Cart")
21
- end
22
-
23
- describe "correct displaying of microdata" do
24
- let(:products) { Spree::TestingSupport::Microdata::Document.new(page.body).extract_items }
25
- let(:ringer) { products.keep_if { |product| product.properties["name"].first.match("Ringer") }.first }
26
-
27
- it "correctly displays the product name via microdata" do
28
- expect(ringer.properties["name"]).to eq ["Ruby on Rails Ringer T-Shirt"]
29
- end
30
-
31
- it "correctly displays the product image via microdata" do
32
- expect(ringer.properties['image'].first).to include '/assets/noimage/small'
33
- end
34
-
35
- it "correctly displays the product url via microdata" do
36
- expect(ringer.properties["url"]).to eq ["/products/ruby-on-rails-ringer-t-shirt"]
37
- end
38
- end
39
-
40
- describe 'meta tags and title' do
41
- let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
42
- let(:metas) { { meta_description: 'Brand new Ruby on Rails Jersey', meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', meta_keywords: 'ror, jersey, ruby' } }
43
-
44
- it 'should return the correct title when displaying a single product' do
45
- click_link jersey.name
46
- expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
47
- within('div#product-description') do
48
- within('h1.product-title') do
49
- expect(page).to have_content('Ruby on Rails Baseball Jersey')
50
- end
51
- end
52
- end
53
-
54
- it 'displays metas' do
55
- jersey.update_attributes metas
56
- click_link jersey.name
57
- expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
58
- expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
59
- end
60
-
61
- it 'displays title if set' do
62
- jersey.update_attributes metas
63
- click_link jersey.name
64
- expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
65
- end
66
-
67
- it "doesn't use meta_title as heading on page" do
68
- jersey.update_attributes metas
69
- click_link jersey.name
70
- within("h1") do
71
- expect(page).to have_content(jersey.name)
72
- expect(page).not_to have_content(jersey.meta_title)
73
- end
74
- end
75
-
76
- it 'uses product name in title when meta_title set to empty string' do
77
- jersey.update_attributes meta_title: ''
78
- click_link jersey.name
79
- expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
80
- end
81
- end
82
-
83
- context "using Russian Rubles as a currency" do
84
- before do
85
- Spree::Config[:currency] = "RUB"
86
- end
87
-
88
- let!(:product) do
89
- product = Spree::Product.find_by_name("Ruby on Rails Ringer T-Shirt")
90
- product.price = 19.99
91
- product.tap(&:save)
92
- end
93
-
94
- # Regression tests for #2737
95
- context "uses руб as the currency symbol" do
96
- it "on products page" do
97
- visit spree.root_path
98
- within("#product_#{product.id}") do
99
- within(".price") do
100
- expect(page).to have_content("19.99 ₽")
101
- end
102
- end
103
- end
104
-
105
- it "on product page" do
106
- visit spree.product_path(product)
107
- within(".price") do
108
- expect(page).to have_content("19.99 ₽")
109
- end
110
- end
111
-
112
- it "when adding a product to the cart", js: true do
113
- visit spree.product_path(product)
114
- click_button "Add To Cart"
115
- click_link "Home"
116
- within(".cart-info") do
117
- expect(page).to have_content("19.99 ₽")
118
- end
119
- end
120
-
121
- it "when on the 'address' state of the cart", js: true do
122
- visit spree.product_path(product)
123
- click_button "Add To Cart"
124
- click_button "Checkout"
125
- fill_in "order_email", with: "test@example.com"
126
- click_button 'Continue'
127
- within("tr[data-hook=item_total]") do
128
- expect(page).to have_content("19.99 ₽")
129
- end
130
- end
131
- end
132
- end
133
-
134
- it "should be able to search for a product" do
135
- fill_in "keywords", with: "shirt"
136
- click_button "Search"
137
-
138
- expect(page.all('#products .product-list-item').size).to eq(1)
139
- end
140
-
141
- context "a product with variants" do
142
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
143
- let(:option_value) { create(:option_value) }
144
- let!(:variant) { build(:variant, price: 5.59, product: product, option_values: []) }
145
-
146
- before do
147
- # Need to have two images to trigger the error
148
- image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
149
- product.images.create!(attachment: image)
150
- product.images.create!(attachment: image)
151
-
152
- product.option_types << option_value.option_type
153
- variant.option_values << option_value
154
- variant.save!
155
- end
156
-
157
- it "should be displayed" do
158
- expect { click_link product.name }.to_not raise_error
159
- end
160
-
161
- it "displays price of first variant listed", js: true do
162
- click_link product.name
163
- within("#product-price") do
164
- expect(page).to have_content variant.price
165
- expect(page).not_to have_content Spree.t(:out_of_stock)
166
- end
167
- end
168
-
169
- it "doesn't display out of stock for master product" do
170
- product.master.stock_items.update_all count_on_hand: 0, backorderable: false
171
-
172
- click_link product.name
173
- within("#product-price") do
174
- expect(page).not_to have_content Spree.t(:out_of_stock)
175
- end
176
- end
177
-
178
- it "doesn't display cart form if all variants (including master) are out of stock" do
179
- product.variants_including_master.each { |v| v.stock_items.update_all count_on_hand: 0, backorderable: false }
180
-
181
- click_link product.name
182
- within("[data-hook=product_price]") do
183
- expect(page).not_to have_content Spree.t(:add_to_cart)
184
- end
185
- end
186
- end
187
-
188
- context "a product with variants, images only for the variants" do
189
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
190
- let(:variant1) { create(:variant, product: product, price: 9.99) }
191
- let(:variant2) { create(:variant, product: product, price: 10.99) }
192
-
193
- before do
194
- image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
195
- variant1.images.create!(attachment: image)
196
- variant2.images.create!(attachment: image)
197
- end
198
-
199
- it "should not display no image available" do
200
- visit spree.root_path
201
- expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
202
- end
203
- end
204
-
205
- context "an out of stock product without variants" do
206
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Tote") }
207
-
208
- before do
209
- product.master.stock_items.update_all count_on_hand: 0, backorderable: false
210
- end
211
-
212
- it "does display out of stock for master product" do
213
- click_link product.name
214
- within("#product-price") do
215
- expect(page).to have_content Spree.t(:out_of_stock)
216
- end
217
- end
218
-
219
- it "doesn't display cart form if master is out of stock" do
220
- click_link product.name
221
- within("[data-hook=product_price]") do
222
- expect(page).not_to have_content Spree.t(:add_to_cart)
223
- end
224
- end
225
- end
226
-
227
- context 'product with taxons' do
228
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Tote") }
229
- let(:taxon) { product.taxons.first }
230
-
231
- it 'displays breadcrumbs for the default taxon when none selected' do
232
- click_link product.name
233
- within("#breadcrumbs") do
234
- expect(page).to have_content taxon.name
235
- end
236
- end
237
-
238
- it 'displays selected taxon in breadcrumbs' do
239
- taxon = Spree::Taxon.last
240
- product.taxons << taxon
241
- product.save!
242
- visit '/t/' + taxon.to_param
243
- click_link product.name
244
- within("#breadcrumbs") do
245
- expect(page).to have_content taxon.name
246
- end
247
- end
248
- end
249
-
250
- it "should be able to hide products without price" do
251
- expect(page.all('#products .product-list-item').size).to eq(9)
252
- Spree::Config.show_products_without_price = false
253
- Spree::Config.currency = "CAN"
254
- visit spree.root_path
255
- expect(page.all('#products .product-list-item').size).to eq(0)
256
- end
257
-
258
-
259
- it "should be able to display products priced under 10 dollars" do
260
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
261
- check "Price_Range_Under_$10.00"
262
- within(:css, '#sidebar_products_search') { click_button "Search" }
263
- expect(page).to have_content("No products found")
264
- end
265
-
266
- it "should be able to display products priced between 15 and 18 dollars" do
267
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
268
- check "Price_Range_$15.00_-_$18.00"
269
- within(:css, '#sidebar_products_search') { click_button "Search" }
270
-
271
- expect(page.all('#products .product-list-item').size).to eq(3)
272
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
273
- tmp.delete("")
274
- expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"])
275
- end
276
-
277
- it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
278
- Spree::Config.products_per_page = 2
279
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
280
- check "Price_Range_$15.00_-_$18.00"
281
- within(:css, '#sidebar_products_search') { click_button "Search" }
282
-
283
- expect(page.all('#products .product-list-item').size).to eq(2)
284
- products = page.all('#products .product-list-item span[itemprop=name]')
285
- expect(products.count).to eq(2)
286
-
287
- find('.pagination .next a').click
288
- products = page.all('#products .product-list-item span[itemprop=name]')
289
- expect(products.count).to eq(1)
290
- end
291
-
292
- it "should be able to display products priced 18 dollars and above" do
293
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
294
- check "Price_Range_$18.00_-_$20.00"
295
- check "Price_Range_$20.00_or_over"
296
- within(:css, '#sidebar_products_search') { click_button "Search" }
297
-
298
- expect(page.all('#products .product-list-item').size).to eq(4)
299
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
300
- tmp.delete("")
301
- expect(tmp.sort!).to eq(["Ruby on Rails Bag",
302
- "Ruby on Rails Baseball Jersey",
303
- "Ruby on Rails Jr. Spaghetti",
304
- "Ruby on Rails Ringer T-Shirt"])
305
- end
306
-
307
- it "should be able to put a product without a description in the cart" do
308
- product = FactoryGirl.create(:base_product, description: nil, name: 'Sample', price: '19.99')
309
- visit spree.product_path(product)
310
- expect(page).to have_content "This product has no description"
311
- click_button 'add-to-cart-button'
312
- expect(page).to have_content "This product has no description"
313
- end
314
-
315
- it "shouldn't be able to put a product without a current price in the cart" do
316
- product = FactoryGirl.create(:base_product, description: nil, name: 'Sample', price: '19.99')
317
- Spree::Config.currency = "CAN"
318
- Spree::Config.show_products_without_price = true
319
- visit spree.product_path(product)
320
- expect(page).to have_content "This product is not available in the selected currency."
321
- expect(page).not_to have_content "add-to-cart-button"
322
- end
323
-
324
- it "should return the correct title when displaying a single product" do
325
- product = Spree::Product.find_by_name("Ruby on Rails Baseball Jersey")
326
- click_link product.name
327
-
328
- within("div#product-description") do
329
- within("h1.product-title") do
330
- expect(page).to have_content("Ruby on Rails Baseball Jersey")
331
- end
332
- end
333
- end
334
- end
@@ -1,147 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "viewing products", type: :feature, inaccessible: true do
4
- let!(:taxonomy) { create(:taxonomy, name: "Category") }
5
- let!(:super_clothing) { taxonomy.root.children.create(name: "Super Clothing") }
6
- let!(:t_shirts) { super_clothing.children.create(name: "T-Shirts") }
7
- let!(:xxl) { t_shirts.children.create(name: "XXL") }
8
- let!(:product) do
9
- product = create(:product, name: "Superman T-Shirt")
10
- product.taxons << t_shirts
11
- end
12
- let(:metas) { { meta_description: 'Brand new Ruby on Rails TShirts', meta_title: "Ruby On Rails TShirt", meta_keywords: 'ror, tshirt, ruby' } }
13
- let(:store_name) do
14
- ((first_store = Spree::Store.first) && first_store.name).to_s
15
- end
16
-
17
- # Regression test for #1796
18
- it "can see a taxon's products, even if that taxon has child taxons" do
19
- visit '/t/category/super-clothing/t-shirts'
20
- expect(page).to have_content("Superman T-Shirt")
21
- end
22
-
23
- it "shouldn't show nested taxons with a search" do
24
- visit '/t/category/super-clothing?keywords=shirt'
25
- expect(page).to have_content("Superman T-Shirt")
26
- expect(page).not_to have_selector("div[data-hook='taxon_children']")
27
- end
28
-
29
- describe 'breadcrumbs' do
30
- before do
31
- visit '/t/category/super-clothing/t-shirts'
32
- end
33
- it "should render breadcrumbs" do
34
- expect(page.find("#breadcrumbs")).to have_link("T-Shirts")
35
- end
36
- it "should mark last breadcrumb as active" do
37
- expect(page.find('#breadcrumbs .active')).to have_link("T-Shirts")
38
- end
39
- end
40
-
41
- describe 'meta tags and title' do
42
- it 'displays metas' do
43
- t_shirts.update_attributes metas
44
- visit '/t/category/super-clothing/t-shirts'
45
- expect(page).to have_meta(:description, 'Brand new Ruby on Rails TShirts')
46
- expect(page).to have_meta(:keywords, 'ror, tshirt, ruby')
47
- end
48
-
49
- it 'display title if set' do
50
- t_shirts.update_attributes metas
51
- visit '/t/category/super-clothing/t-shirts'
52
- expect(page).to have_title("Ruby On Rails TShirt")
53
- end
54
-
55
- it 'displays title from taxon root and taxon name' do
56
- visit '/t/category/super-clothing/t-shirts'
57
- expect(page).to have_title('Category - T-Shirts - ' + store_name)
58
- end
59
-
60
- # Regression test for #2814
61
- it "doesn't use meta_title as heading on page" do
62
- t_shirts.update_attributes metas
63
- visit '/t/category/super-clothing/t-shirts'
64
- within("h1.taxon-title") do
65
- expect(page).to have_content(t_shirts.name)
66
- end
67
- end
68
-
69
- it 'uses taxon name in title when meta_title set to empty string' do
70
- t_shirts.update_attributes meta_title: ''
71
- visit '/t/category/super-clothing/t-shirts'
72
- expect(page).to have_title('Category - T-Shirts - ' + store_name)
73
- end
74
- end
75
-
76
- context "taxon pages" do
77
- include_context "custom products"
78
- before do
79
- visit spree.root_path
80
- end
81
-
82
- it "should be able to visit brand Ruby on Rails" do
83
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
84
-
85
- expect(page.all('#products .product-list-item').size).to eq(7)
86
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
87
- tmp.delete("")
88
- array = ["Ruby on Rails Bag",
89
- "Ruby on Rails Baseball Jersey",
90
- "Ruby on Rails Jr. Spaghetti",
91
- "Ruby on Rails Mug",
92
- "Ruby on Rails Ringer T-Shirt",
93
- "Ruby on Rails Stein",
94
- "Ruby on Rails Tote"]
95
- expect(tmp.sort!).to eq(array)
96
- end
97
-
98
- it "should be able to visit brand Ruby" do
99
- within(:css, '#taxonomies') { click_link "Ruby" }
100
-
101
- expect(page.all('#products .product-list-item').size).to eq(1)
102
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
103
- tmp.delete("")
104
- expect(tmp.sort!).to eq(["Ruby Baseball Jersey"])
105
- end
106
-
107
- it "should be able to visit brand Apache" do
108
- within(:css, '#taxonomies') { click_link "Apache" }
109
-
110
- expect(page.all('#products .product-list-item').size).to eq(1)
111
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
112
- tmp.delete("")
113
- expect(tmp.sort!).to eq(["Apache Baseball Jersey"])
114
- end
115
-
116
- it "should be able to visit category Clothing" do
117
- click_link "Clothing"
118
-
119
- expect(page.all('#products .product-list-item').size).to eq(5)
120
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
121
- tmp.delete("")
122
- expect(tmp.sort!).to eq(["Apache Baseball Jersey",
123
- "Ruby Baseball Jersey",
124
- "Ruby on Rails Baseball Jersey",
125
- "Ruby on Rails Jr. Spaghetti",
126
- "Ruby on Rails Ringer T-Shirt"])
127
- end
128
-
129
- it "should be able to visit category Mugs" do
130
- click_link "Mugs"
131
-
132
- expect(page.all('#products .product-list-item').size).to eq(2)
133
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
134
- tmp.delete("")
135
- expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein"])
136
- end
137
-
138
- it "should be able to visit category Bags" do
139
- click_link "Bags"
140
-
141
- expect(page.all('#products .product-list-item').size).to eq(2)
142
- tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
143
- tmp.delete("")
144
- expect(tmp.sort!).to eq(["Ruby on Rails Bag", "Ruby on Rails Tote"])
145
- end
146
- end
147
- end