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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/frontend.js +0 -1
- data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +0 -2
- data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +1 -1
- data/app/controllers/spree/orders_controller.rb +17 -15
- data/app/helpers/spree/frontend_helper.rb +0 -5
- data/app/helpers/spree/store_helper.rb +5 -0
- data/app/views/spree/address/_form.html.erb +12 -10
- data/app/views/spree/checkout/edit.html.erb +1 -5
- data/app/views/spree/products/_product.html.erb +22 -0
- data/app/views/spree/shared/_header.html.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +1 -3
- data/app/views/spree/{payments → shared}/_payment.html.erb +2 -0
- data/app/views/spree/shared/_products.html.erb +1 -25
- data/app/views/spree/shared/_search.html.erb +1 -2
- data/config/routes.rb +4 -0
- data/lib/spree/frontend/engine.rb +0 -1
- data/spree_frontend.gemspec +1 -2
- metadata +10 -139
- data/app/views/spree/store/cart_link.html.erb +0 -1
- data/config/initializers/spree.rb +0 -2
- data/lib/tasks/rake_util.rb +0 -19
- data/lib/tasks/taxon.rake +0 -14
- data/spec/controllers/controller_extension_spec.rb +0 -126
- data/spec/controllers/controller_helpers_spec.rb +0 -122
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -547
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
- data/spec/controllers/spree/content_controller_spec.rb +0 -12
- data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
- data/spec/controllers/spree/home_controller_spec.rb +0 -47
- data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -96
- data/spec/controllers/spree/orders_controller_spec.rb +0 -134
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -31
- data/spec/controllers/spree/products_controller_spec.rb +0 -87
- data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
- data/spec/features/address_spec.rb +0 -93
- data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
- data/spec/features/caching/products_spec.rb +0 -59
- data/spec/features/caching/taxons_spec.rb +0 -22
- data/spec/features/cart_spec.rb +0 -132
- data/spec/features/checkout_spec.rb +0 -723
- data/spec/features/checkout_unshippable_spec.rb +0 -34
- data/spec/features/coupon_code_spec.rb +0 -88
- data/spec/features/currency_spec.rb +0 -18
- data/spec/features/delivery_spec.rb +0 -64
- data/spec/features/free_shipping_promotions_spec.rb +0 -59
- data/spec/features/locale_spec.rb +0 -60
- data/spec/features/microdata_spec.rb +0 -0
- data/spec/features/order_spec.rb +0 -107
- data/spec/features/page_promotions_spec.rb +0 -36
- data/spec/features/products_spec.rb +0 -345
- data/spec/features/taxons_spec.rb +0 -147
- data/spec/features/template_rendering_spec.rb +0 -19
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/helpers/frontend_helper_spec.rb +0 -57
- data/spec/helpers/taxons_helper_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -128
- data/spec/support/shared_contexts/checkout_setup.rb +0 -10
- data/spec/support/shared_contexts/custom_products.rb +0 -25
- data/spec/support/shared_contexts/product_prototypes.rb +0 -30
- data/spec/views/spree/checkout/_summary_spec.rb +0 -11
- data/vendor/assets/javascripts/jquery.validate/additional-methods.min.js +0 -12
- data/vendor/assets/javascripts/jquery.validate/jquery.validate.min.js +0 -12
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ar.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_bg.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ca.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_cs.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_da.js +0 -22
- data/vendor/assets/javascripts/jquery.validate/localization/messages_de.js +0 -22
- data/vendor/assets/javascripts/jquery.validate/localization/messages_el.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_es.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_et.js +0 -23
- data/vendor/assets/javascripts/jquery.validate/localization/messages_eu.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_fa.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_fi.js +0 -23
- data/vendor/assets/javascripts/jquery.validate/localization/messages_fr.js +0 -47
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ge.js +0 -23
- data/vendor/assets/javascripts/jquery.validate/localization/messages_he.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_hr.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_hu.js +0 -24
- data/vendor/assets/javascripts/jquery.validate/localization/messages_it.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ja.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ka.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_kk.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ko.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_lt.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_lv.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ms.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_nl.js +0 -35
- data/vendor/assets/javascripts/jquery.validate/localization/messages_no.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_pl.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ptbr.js +0 -24
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ptpt.js +0 -24
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ro.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_ru.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_se.js +0 -23
- data/vendor/assets/javascripts/jquery.validate/localization/messages_si.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sk.js +0 -22
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sl.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sr.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_sv.js +0 -23
- data/vendor/assets/javascripts/jquery.validate/localization/messages_th.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_tr.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_tw.js +0 -24
- data/vendor/assets/javascripts/jquery.validate/localization/messages_uk.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_vi.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_zh.js +0 -25
- data/vendor/assets/javascripts/jquery.validate/localization/messages_zhtw.js +0 -26
- data/vendor/assets/javascripts/jquery.validate/localization/methods_de.js +0 -12
- data/vendor/assets/javascripts/jquery.validate/localization/methods_nl.js +0 -9
- data/vendor/assets/javascripts/jquery.validate/localization/methods_pt.js +0 -9
@@ -1,345 +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(:product) { Spree::Product.find_by(name: 'Ruby on Rails Ringer T-Shirt') }
|
25
|
-
|
26
|
-
it "on products page" do
|
27
|
-
within("#product_#{product.id}") do
|
28
|
-
within('[itemprop=name]') do
|
29
|
-
expect(page).to have_content('Ruby on Rails Ringer T-Shirt')
|
30
|
-
end
|
31
|
-
expect(page).to have_css("[itemprop='price'][content='19.99']")
|
32
|
-
expect(page).to have_css("[itemprop='priceCurrency'][content='USD']")
|
33
|
-
expect(page).to have_css("[itemprop='url'][href='/products/ruby-on-rails-ringer-t-shirt']")
|
34
|
-
expect(page).to have_css("[itemprop='image'][src*='/assets/noimage/small']")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "on product page" do
|
39
|
-
click_link product.name
|
40
|
-
within('[data-hook=product_show]') do
|
41
|
-
within('[itemprop=name]') do
|
42
|
-
expect(page).to have_content('Ruby on Rails Ringer T-Shirt')
|
43
|
-
end
|
44
|
-
expect(page).to have_css("[itemprop='price'][content='19.99']")
|
45
|
-
expect(page).to have_css("[itemprop='priceCurrency'][content='USD']")
|
46
|
-
expect(page).to have_css("[itemprop='image'][src*='/assets/noimage/product']")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'meta tags and title' do
|
52
|
-
let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
|
53
|
-
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' } }
|
54
|
-
|
55
|
-
it 'should return the correct title when displaying a single product' do
|
56
|
-
click_link jersey.name
|
57
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
58
|
-
within('div#product-description') do
|
59
|
-
within('h1.product-title') do
|
60
|
-
expect(page).to have_content('Ruby on Rails Baseball Jersey')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'displays metas' do
|
66
|
-
jersey.update_attributes metas
|
67
|
-
click_link jersey.name
|
68
|
-
expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
|
69
|
-
expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'displays title if set' do
|
73
|
-
jersey.update_attributes metas
|
74
|
-
click_link jersey.name
|
75
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
|
76
|
-
end
|
77
|
-
|
78
|
-
it "doesn't use meta_title as heading on page" do
|
79
|
-
jersey.update_attributes metas
|
80
|
-
click_link jersey.name
|
81
|
-
within("h1") do
|
82
|
-
expect(page).to have_content(jersey.name)
|
83
|
-
expect(page).not_to have_content(jersey.meta_title)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'uses product name in title when meta_title set to empty string' do
|
88
|
-
jersey.update_attributes meta_title: ''
|
89
|
-
click_link jersey.name
|
90
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context "using Russian Rubles as a currency" do
|
95
|
-
before do
|
96
|
-
Spree::Config[:currency] = "RUB"
|
97
|
-
end
|
98
|
-
|
99
|
-
let!(:product) do
|
100
|
-
product = Spree::Product.find_by_name("Ruby on Rails Ringer T-Shirt")
|
101
|
-
product.price = 19.99
|
102
|
-
product.tap(&:save)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Regression tests for #2737
|
106
|
-
context "uses руб as the currency symbol" do
|
107
|
-
it "on products page" do
|
108
|
-
visit spree.root_path
|
109
|
-
within("#product_#{product.id}") do
|
110
|
-
within(".price") do
|
111
|
-
expect(page).to have_content("19.99 ₽")
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
it "on product page" do
|
117
|
-
visit spree.product_path(product)
|
118
|
-
within(".price") do
|
119
|
-
expect(page).to have_content("19.99 ₽")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it "when adding a product to the cart", js: true do
|
124
|
-
visit spree.product_path(product)
|
125
|
-
click_button "Add To Cart"
|
126
|
-
click_link "Home"
|
127
|
-
within(".cart-info") do
|
128
|
-
expect(page).to have_content("19.99 ₽")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
it "when on the 'address' state of the cart", js: true do
|
133
|
-
visit spree.product_path(product)
|
134
|
-
click_button "Add To Cart"
|
135
|
-
click_button "Checkout"
|
136
|
-
fill_in "order_email", with: "test@example.com"
|
137
|
-
click_button 'Continue'
|
138
|
-
within("tr[data-hook=item_total]") do
|
139
|
-
expect(page).to have_content("19.99 ₽")
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
it "should be able to search for a product" do
|
146
|
-
fill_in "keywords", with: "shirt"
|
147
|
-
click_button "Search"
|
148
|
-
|
149
|
-
expect(page.all('#products .product-list-item').size).to eq(1)
|
150
|
-
end
|
151
|
-
|
152
|
-
context "a product with variants" do
|
153
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
|
154
|
-
let(:option_value) { create(:option_value) }
|
155
|
-
let!(:variant) { build(:variant, price: 5.59, product: product, option_values: []) }
|
156
|
-
|
157
|
-
before do
|
158
|
-
# Need to have two images to trigger the error
|
159
|
-
image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
|
160
|
-
product.images.create!(attachment: image)
|
161
|
-
product.images.create!(attachment: image)
|
162
|
-
|
163
|
-
product.option_types << option_value.option_type
|
164
|
-
variant.option_values << option_value
|
165
|
-
variant.save!
|
166
|
-
end
|
167
|
-
|
168
|
-
it "should be displayed" do
|
169
|
-
expect { click_link product.name }.to_not raise_error
|
170
|
-
end
|
171
|
-
|
172
|
-
it "displays price of first variant listed", js: true do
|
173
|
-
click_link product.name
|
174
|
-
within("#product-price") do
|
175
|
-
expect(page).to have_content variant.price
|
176
|
-
expect(page).not_to have_content Spree.t(:out_of_stock)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
it "doesn't display out of stock for master product" do
|
181
|
-
product.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
182
|
-
|
183
|
-
click_link product.name
|
184
|
-
within("#product-price") do
|
185
|
-
expect(page).not_to have_content Spree.t(:out_of_stock)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
it "doesn't display cart form if all variants (including master) are out of stock" do
|
190
|
-
product.variants_including_master.each { |v| v.stock_items.update_all count_on_hand: 0, backorderable: false }
|
191
|
-
|
192
|
-
click_link product.name
|
193
|
-
within("[data-hook=product_price]") do
|
194
|
-
expect(page).not_to have_content Spree.t(:add_to_cart)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
context "a product with variants, images only for the variants" do
|
200
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
|
201
|
-
let(:variant1) { create(:variant, product: product, price: 9.99) }
|
202
|
-
let(:variant2) { create(:variant, product: product, price: 10.99) }
|
203
|
-
|
204
|
-
before do
|
205
|
-
image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
|
206
|
-
variant1.images.create!(attachment: image)
|
207
|
-
variant2.images.create!(attachment: image)
|
208
|
-
end
|
209
|
-
|
210
|
-
it "should not display no image available" do
|
211
|
-
visit spree.root_path
|
212
|
-
expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
context "an out of stock product without variants" do
|
217
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Tote") }
|
218
|
-
|
219
|
-
before do
|
220
|
-
product.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
221
|
-
end
|
222
|
-
|
223
|
-
it "does display out of stock for master product" do
|
224
|
-
click_link product.name
|
225
|
-
within("#product-price") do
|
226
|
-
expect(page).to have_content Spree.t(:out_of_stock)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
it "doesn't display cart form if master is out of stock" do
|
231
|
-
click_link product.name
|
232
|
-
within("[data-hook=product_price]") do
|
233
|
-
expect(page).not_to have_content Spree.t(:add_to_cart)
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
context 'product with taxons' do
|
239
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Tote") }
|
240
|
-
let(:taxon) { product.taxons.first }
|
241
|
-
|
242
|
-
it 'displays breadcrumbs for the default taxon when none selected' do
|
243
|
-
click_link product.name
|
244
|
-
within("#breadcrumbs") do
|
245
|
-
expect(page).to have_content taxon.name
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'displays selected taxon in breadcrumbs' do
|
250
|
-
taxon = Spree::Taxon.last
|
251
|
-
product.taxons << taxon
|
252
|
-
product.save!
|
253
|
-
visit '/t/' + taxon.to_param
|
254
|
-
click_link product.name
|
255
|
-
within("#breadcrumbs") do
|
256
|
-
expect(page).to have_content taxon.name
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
it "should be able to hide products without price" do
|
262
|
-
expect(page.all('#products .product-list-item').size).to eq(9)
|
263
|
-
Spree::Config.show_products_without_price = false
|
264
|
-
Spree::Config.currency = "CAN"
|
265
|
-
visit spree.root_path
|
266
|
-
expect(page.all('#products .product-list-item').size).to eq(0)
|
267
|
-
end
|
268
|
-
|
269
|
-
|
270
|
-
it "should be able to display products priced under 10 dollars" do
|
271
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
272
|
-
check "Price_Range_Under_$10.00"
|
273
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
274
|
-
expect(page).to have_content("No products found")
|
275
|
-
end
|
276
|
-
|
277
|
-
it "should be able to display products priced between 15 and 18 dollars" do
|
278
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
279
|
-
check "Price_Range_$15.00_-_$18.00"
|
280
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
281
|
-
|
282
|
-
expect(page.all('#products .product-list-item').size).to eq(3)
|
283
|
-
tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
|
284
|
-
tmp.delete("")
|
285
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"])
|
286
|
-
end
|
287
|
-
|
288
|
-
it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
|
289
|
-
Spree::Config.products_per_page = 2
|
290
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
291
|
-
check "Price_Range_$15.00_-_$18.00"
|
292
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
293
|
-
|
294
|
-
expect(page.all('#products .product-list-item').size).to eq(2)
|
295
|
-
products = page.all('#products .product-list-item span[itemprop=name]')
|
296
|
-
expect(products.count).to eq(2)
|
297
|
-
|
298
|
-
find('.pagination .next a').click
|
299
|
-
products = page.all('#products .product-list-item span[itemprop=name]')
|
300
|
-
expect(products.count).to eq(1)
|
301
|
-
end
|
302
|
-
|
303
|
-
it "should be able to display products priced 18 dollars and above" do
|
304
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
305
|
-
check "Price_Range_$18.00_-_$20.00"
|
306
|
-
check "Price_Range_$20.00_or_over"
|
307
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
308
|
-
|
309
|
-
expect(page.all('#products .product-list-item').size).to eq(4)
|
310
|
-
tmp = page.all('#products .product-list-item a').map(&:text).flatten.compact
|
311
|
-
tmp.delete("")
|
312
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Bag",
|
313
|
-
"Ruby on Rails Baseball Jersey",
|
314
|
-
"Ruby on Rails Jr. Spaghetti",
|
315
|
-
"Ruby on Rails Ringer T-Shirt"])
|
316
|
-
end
|
317
|
-
|
318
|
-
it "should be able to put a product without a description in the cart" do
|
319
|
-
product = FactoryGirl.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
320
|
-
visit spree.product_path(product)
|
321
|
-
expect(page).to have_content "This product has no description"
|
322
|
-
click_button 'add-to-cart-button'
|
323
|
-
expect(page).to have_content "This product has no description"
|
324
|
-
end
|
325
|
-
|
326
|
-
it "shouldn't be able to put a product without a current price in the cart" do
|
327
|
-
product = FactoryGirl.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
328
|
-
Spree::Config.currency = "CAN"
|
329
|
-
Spree::Config.show_products_without_price = true
|
330
|
-
visit spree.product_path(product)
|
331
|
-
expect(page).to have_content "This product is not available in the selected currency."
|
332
|
-
expect(page).not_to have_content "add-to-cart-button"
|
333
|
-
end
|
334
|
-
|
335
|
-
it "should return the correct title when displaying a single product" do
|
336
|
-
product = Spree::Product.find_by_name("Ruby on Rails Baseball Jersey")
|
337
|
-
click_link product.name
|
338
|
-
|
339
|
-
within("div#product-description") do
|
340
|
-
within("h1.product-title") do
|
341
|
-
expect(page).to have_content("Ruby on Rails Baseball Jersey")
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
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
|