solidus_frontend 1.0.7 → 1.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_frontend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +6 -5
- data/app/controllers/spree/checkout_controller.rb +5 -3
- data/app/controllers/spree/store_controller.rb +2 -1
- data/app/views/spree/address/_form.html.erb +15 -15
- data/lib/spree/frontend.rb +0 -2
- metadata +9 -79
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/lib/spree/frontend/preference_rescue.rb +0 -25
- data/script/rails +0 -9
- data/solidus_frontend.gemspec +0 -30
- data/spec/controllers/controller_extension_spec.rb +0 -126
- data/spec/controllers/controller_helpers_spec.rb +0 -26
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -447
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
- data/spec/controllers/spree/content_controller_spec.rb +0 -7
- data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
- data/spec/controllers/spree/home_controller_spec.rb +0 -27
- data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -104
- 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 -36
- data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
- data/spec/features/address_spec.rb +0 -76
- data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
- data/spec/features/caching/products_spec.rb +0 -55
- data/spec/features/caching/taxons_spec.rb +0 -22
- data/spec/features/cart_spec.rb +0 -81
- data/spec/features/checkout_spec.rb +0 -513
- data/spec/features/checkout_unshippable_spec.rb +0 -35
- data/spec/features/coupon_code_spec.rb +0 -227
- data/spec/features/currency_spec.rb +0 -18
- data/spec/features/free_shipping_promotions_spec.rb +0 -59
- data/spec/features/locale_spec.rb +0 -60
- data/spec/features/order_spec.rb +0 -73
- data/spec/features/products_spec.rb +0 -260
- data/spec/features/promotion_code_invalidation_spec.rb +0 -51
- data/spec/features/quantity_promotions_spec.rb +0 -128
- data/spec/features/taxons_spec.rb +0 -135
- data/spec/features/template_rendering_spec.rb +0 -19
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/helpers/base_helper_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -121
- data/spec/support/shared_contexts/checkout_setup.rb +0 -9
- 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
@@ -1,260 +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 'meta tags and title' do
|
24
|
-
let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
|
25
|
-
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' } }
|
26
|
-
|
27
|
-
it 'should return the correct title when displaying a single product' do
|
28
|
-
click_link jersey.name
|
29
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
30
|
-
within('div#product-description') do
|
31
|
-
within('h1.product-title') do
|
32
|
-
expect(page).to have_content('Ruby on Rails Baseball Jersey')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'displays metas' do
|
38
|
-
jersey.update_attributes metas
|
39
|
-
click_link jersey.name
|
40
|
-
expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
|
41
|
-
expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'displays title if set' do
|
45
|
-
jersey.update_attributes metas
|
46
|
-
click_link jersey.name
|
47
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
|
48
|
-
end
|
49
|
-
|
50
|
-
it "doesn't use meta_title as heading on page" do
|
51
|
-
jersey.update_attributes metas
|
52
|
-
click_link jersey.name
|
53
|
-
within("h1") do
|
54
|
-
expect(page).to have_content(jersey.name)
|
55
|
-
expect(page).not_to have_content(jersey.meta_title)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'uses product name in title when meta_title set to empty string' do
|
60
|
-
jersey.update_attributes meta_title: ''
|
61
|
-
click_link jersey.name
|
62
|
-
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context "using Russian Rubles as a currency" do
|
67
|
-
before do
|
68
|
-
Spree::Config[:currency] = "RUB"
|
69
|
-
end
|
70
|
-
|
71
|
-
let!(:product) do
|
72
|
-
product = Spree::Product.find_by_name("Ruby on Rails Ringer T-Shirt")
|
73
|
-
product.price = 19.99
|
74
|
-
product.tap(&:save)
|
75
|
-
end
|
76
|
-
|
77
|
-
# Regression tests for #2737
|
78
|
-
context "uses руб as the currency symbol" do
|
79
|
-
it "on products page" do
|
80
|
-
visit spree.root_path
|
81
|
-
within("#product_#{product.id}") do
|
82
|
-
within(".price") do
|
83
|
-
expect(page).to have_content("19.99 ₽")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
it "on product page" do
|
89
|
-
visit spree.product_path(product)
|
90
|
-
within(".price") do
|
91
|
-
expect(page).to have_content("19.99 ₽")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it "when adding a product to the cart", :js => true do
|
96
|
-
visit spree.product_path(product)
|
97
|
-
click_button "Add To Cart"
|
98
|
-
click_link "Home"
|
99
|
-
within(".cart-info") do
|
100
|
-
expect(page).to have_content("19.99 ₽")
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
it "when on the 'address' state of the cart" do
|
105
|
-
visit spree.product_path(product)
|
106
|
-
click_button "Add To Cart"
|
107
|
-
click_button "Checkout"
|
108
|
-
within("tr[data-hook=item_total]") do
|
109
|
-
expect(page).to have_content("19.99 ₽")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should be able to search for a product" do
|
116
|
-
fill_in "keywords", :with => "shirt"
|
117
|
-
click_button "Search"
|
118
|
-
|
119
|
-
expect(page.all('ul.product-listing li').size).to eq(1)
|
120
|
-
end
|
121
|
-
|
122
|
-
context "a product with variants" do
|
123
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
|
124
|
-
let(:option_value) { create(:option_value) }
|
125
|
-
let!(:variant) { product.variants.create!(:price => 5.59) }
|
126
|
-
|
127
|
-
before do
|
128
|
-
# Need to have two images to trigger the error
|
129
|
-
image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
|
130
|
-
product.images.create!(:attachment => image)
|
131
|
-
product.images.create!(:attachment => image)
|
132
|
-
|
133
|
-
product.option_types << option_value.option_type
|
134
|
-
variant.option_values << option_value
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should be displayed" do
|
138
|
-
expect { click_link product.name }.to_not raise_error
|
139
|
-
end
|
140
|
-
|
141
|
-
it "displays price of first variant listed", js: true do
|
142
|
-
click_link product.name
|
143
|
-
within("#product-price") do
|
144
|
-
expect(page).to have_content variant.price
|
145
|
-
expect(page).not_to have_content Spree.t(:out_of_stock)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
it "doesn't display out of stock for master product" do
|
150
|
-
product.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
151
|
-
|
152
|
-
click_link product.name
|
153
|
-
within("#product-price") do
|
154
|
-
expect(page).not_to have_content Spree.t(:out_of_stock)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context "a product with variants, images only for the variants" do
|
160
|
-
let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
|
161
|
-
|
162
|
-
before do
|
163
|
-
image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
|
164
|
-
v1 = product.variants.create!(price: 9.99)
|
165
|
-
v2 = product.variants.create!(price: 10.99)
|
166
|
-
v1.images.create!(attachment: image)
|
167
|
-
v2.images.create!(attachment: image)
|
168
|
-
end
|
169
|
-
|
170
|
-
it "should not display no image available" do
|
171
|
-
visit spree.root_path
|
172
|
-
expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
it "should be able to hide products without price" do
|
177
|
-
expect(page.all('ul.product-listing li').size).to eq(9)
|
178
|
-
Spree::Config.show_products_without_price = false
|
179
|
-
Spree::Config.currency = "CAN"
|
180
|
-
visit spree.root_path
|
181
|
-
expect(page.all('ul.product-listing li').size).to eq(0)
|
182
|
-
end
|
183
|
-
|
184
|
-
|
185
|
-
it "should be able to display products priced under 10 dollars" do
|
186
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
187
|
-
check "Price_Range_Under_$10.00"
|
188
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
189
|
-
expect(page).to have_content("No products found")
|
190
|
-
end
|
191
|
-
|
192
|
-
it "should be able to display products priced between 15 and 18 dollars" do
|
193
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
194
|
-
check "Price_Range_$15.00_-_$18.00"
|
195
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
196
|
-
|
197
|
-
expect(page.all('ul.product-listing li').size).to eq(3)
|
198
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
199
|
-
tmp.delete("")
|
200
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein", "Ruby on Rails Tote"])
|
201
|
-
end
|
202
|
-
|
203
|
-
it "should be able to display products priced between 15 and 18 dollars across multiple pages" do
|
204
|
-
Spree::Config.products_per_page = 2
|
205
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
206
|
-
check "Price_Range_$15.00_-_$18.00"
|
207
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
208
|
-
|
209
|
-
expect(page.all('ul.product-listing li').size).to eq(2)
|
210
|
-
products = page.all('ul.product-listing li a[itemprop=name]')
|
211
|
-
expect(products.count).to eq(2)
|
212
|
-
|
213
|
-
find('nav.pagination .next a').click
|
214
|
-
products = page.all('ul.product-listing li a[itemprop=name]')
|
215
|
-
expect(products.count).to eq(1)
|
216
|
-
end
|
217
|
-
|
218
|
-
it "should be able to display products priced 18 dollars and above" do
|
219
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
220
|
-
check "Price_Range_$18.00_-_$20.00"
|
221
|
-
check "Price_Range_$20.00_or_over"
|
222
|
-
within(:css, '#sidebar_products_search') { click_button "Search" }
|
223
|
-
|
224
|
-
expect(page.all('ul.product-listing li').size).to eq(4)
|
225
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
226
|
-
tmp.delete("")
|
227
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Bag",
|
228
|
-
"Ruby on Rails Baseball Jersey",
|
229
|
-
"Ruby on Rails Jr. Spaghetti",
|
230
|
-
"Ruby on Rails Ringer T-Shirt"])
|
231
|
-
end
|
232
|
-
|
233
|
-
it "should be able to put a product without a description in the cart" do
|
234
|
-
product = FactoryGirl.create(:base_product, :description => nil, :name => 'Sample', :price => '19.99')
|
235
|
-
visit spree.product_path(product)
|
236
|
-
expect(page).to have_content "This product has no description"
|
237
|
-
click_button 'add-to-cart-button'
|
238
|
-
expect(page).to have_content "This product has no description"
|
239
|
-
end
|
240
|
-
|
241
|
-
it "shouldn't be able to put a product without a current price in the cart" do
|
242
|
-
product = FactoryGirl.create(:base_product, :description => nil, :name => 'Sample', :price => '19.99')
|
243
|
-
Spree::Config.currency = "CAN"
|
244
|
-
Spree::Config.show_products_without_price = true
|
245
|
-
visit spree.product_path(product)
|
246
|
-
expect(page).to have_content "This product is not available in the selected currency."
|
247
|
-
expect(page).not_to have_content "add-to-cart-button"
|
248
|
-
end
|
249
|
-
|
250
|
-
it "should return the correct title when displaying a single product" do
|
251
|
-
product = Spree::Product.find_by_name("Ruby on Rails Baseball Jersey")
|
252
|
-
click_link product.name
|
253
|
-
|
254
|
-
within("div#product-description") do
|
255
|
-
within("h1.product-title") do
|
256
|
-
expect(page).to have_content("Ruby on Rails Baseball Jersey")
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.feature "Promotion Code Invalidation" do
|
4
|
-
given!(:promotion) do
|
5
|
-
FactoryGirl.create(
|
6
|
-
:promotion_with_item_adjustment,
|
7
|
-
code: "PROMO",
|
8
|
-
per_code_usage_limit: 1,
|
9
|
-
adjustment_rate: 5
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
background do
|
14
|
-
FactoryGirl.create(:product, name: "DL-44")
|
15
|
-
FactoryGirl.create(:product, name: "E-11")
|
16
|
-
|
17
|
-
visit spree.root_path
|
18
|
-
click_link "DL-44"
|
19
|
-
click_button "Add To Cart"
|
20
|
-
|
21
|
-
visit spree.root_path
|
22
|
-
click_link "E-11"
|
23
|
-
click_button "Add To Cart"
|
24
|
-
end
|
25
|
-
|
26
|
-
scenario "adding the promotion to a cart with two applicable items" do
|
27
|
-
fill_in "Coupon code", with: "PROMO"
|
28
|
-
click_button "Update"
|
29
|
-
|
30
|
-
expect(page).to have_content("The coupon code was successfully applied to your order")
|
31
|
-
|
32
|
-
within("#cart_adjustments") do
|
33
|
-
expect(page).to have_content("-$10.00")
|
34
|
-
end
|
35
|
-
|
36
|
-
# Remove an item
|
37
|
-
fill_in "order_line_items_attributes_0_quantity", with: 0
|
38
|
-
click_button "Update"
|
39
|
-
within("#cart_adjustments") do
|
40
|
-
expect(page).to have_content("-$5.00")
|
41
|
-
end
|
42
|
-
|
43
|
-
# Add it back
|
44
|
-
visit spree.root_path
|
45
|
-
click_link "DL-44"
|
46
|
-
click_button "Add To Cart"
|
47
|
-
within("#cart_adjustments") do
|
48
|
-
expect(page).to have_content("-$10.00")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,128 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.feature "Quantity Promotions" do
|
4
|
-
given(:action) do
|
5
|
-
Spree::Promotion::Actions::CreateQuantityAdjustments.create(
|
6
|
-
calculator: calculator,
|
7
|
-
preferred_group_size: 2
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
given(:promotion) { FactoryGirl.create(:promotion, code: "PROMO") }
|
12
|
-
given(:calculator) { FactoryGirl.create(:calculator, preferred_amount: 5) }
|
13
|
-
|
14
|
-
background do
|
15
|
-
FactoryGirl.create(:product, name: "DL-44")
|
16
|
-
FactoryGirl.create(:product, name: "E-11")
|
17
|
-
promotion.actions << action
|
18
|
-
|
19
|
-
visit spree.root_path
|
20
|
-
click_link "DL-44"
|
21
|
-
click_button "Add To Cart"
|
22
|
-
end
|
23
|
-
|
24
|
-
scenario "adding and removing items from the cart" do
|
25
|
-
# Attempt to use the code with too few items.
|
26
|
-
fill_in "Coupon code", with: "PROMO"
|
27
|
-
click_button "Update"
|
28
|
-
expect(page).to have_content("This coupon code could not be applied to the cart at this time")
|
29
|
-
|
30
|
-
# Add another item to our cart.
|
31
|
-
visit spree.root_path
|
32
|
-
click_link "DL-44"
|
33
|
-
click_button "Add To Cart"
|
34
|
-
|
35
|
-
# Using the code should now succeed.
|
36
|
-
fill_in "Coupon code", with: "PROMO"
|
37
|
-
click_button "Update"
|
38
|
-
expect(page).to have_content("The coupon code was successfully applied to your order")
|
39
|
-
within("#cart_adjustments") do
|
40
|
-
expect(page).to have_content("-$10.00")
|
41
|
-
end
|
42
|
-
|
43
|
-
# Reduce quantity by 1, making promotion not apply.
|
44
|
-
fill_in "order_line_items_attributes_0_quantity", with: 1
|
45
|
-
click_button "Update"
|
46
|
-
expect(page).to_not have_content("#cart_adjustments")
|
47
|
-
|
48
|
-
# Bump quantity to 3, making promotion apply "once."
|
49
|
-
fill_in "order_line_items_attributes_0_quantity", with: 3
|
50
|
-
click_button "Update"
|
51
|
-
within("#cart_adjustments") do
|
52
|
-
expect(page).to have_content("-$10.00")
|
53
|
-
end
|
54
|
-
|
55
|
-
# Bump quantity to 4, making promotion apply "twice."
|
56
|
-
fill_in "order_line_items_attributes_0_quantity", with: 4
|
57
|
-
click_button "Update"
|
58
|
-
within("#cart_adjustments") do
|
59
|
-
expect(page).to have_content("-$20.00")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Catches an earlier issue with quantity calculation.
|
64
|
-
scenario "adding odd numbers of items to the cart" do
|
65
|
-
# Bump quantity to 3
|
66
|
-
fill_in "order_line_items_attributes_0_quantity", with: 3
|
67
|
-
click_button "Update"
|
68
|
-
|
69
|
-
# Apply the promo code and see a $10 discount (for 2 of the 3 items)
|
70
|
-
fill_in "Coupon code", with: "PROMO"
|
71
|
-
click_button "Update"
|
72
|
-
expect(page).to have_content("The coupon code was successfully applied to your order")
|
73
|
-
within("#cart_adjustments") do
|
74
|
-
expect(page).to have_content("-$10.00")
|
75
|
-
end
|
76
|
-
|
77
|
-
# Add a different product to our cart with quantity of 2.
|
78
|
-
visit spree.root_path
|
79
|
-
click_link "E-11"
|
80
|
-
fill_in "quantity", with: "2"
|
81
|
-
click_button "Add To Cart"
|
82
|
-
|
83
|
-
# We now have 5 items total, so discount should increase.
|
84
|
-
within("#cart_adjustments") do
|
85
|
-
expect(page).to have_content("-$20.00")
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "with a group size of 3" do
|
90
|
-
given(:action) do
|
91
|
-
Spree::Promotion::Actions::CreateQuantityAdjustments.create(
|
92
|
-
calculator: calculator,
|
93
|
-
preferred_group_size: 3
|
94
|
-
)
|
95
|
-
end
|
96
|
-
|
97
|
-
background { FactoryGirl.create(:product, name: "DC-15A") }
|
98
|
-
|
99
|
-
scenario "odd number of changes to quantities" do
|
100
|
-
fill_in "order_line_items_attributes_0_quantity", with: 3
|
101
|
-
click_button "Update"
|
102
|
-
|
103
|
-
# Apply the promo code and see a $15 discount
|
104
|
-
fill_in "Coupon code", with: "PROMO"
|
105
|
-
click_button "Update"
|
106
|
-
expect(page).to have_content("The coupon code was successfully applied to your order")
|
107
|
-
within("#cart_adjustments") do
|
108
|
-
expect(page).to have_content("-$15.00")
|
109
|
-
end
|
110
|
-
|
111
|
-
# Add two different products to our cart
|
112
|
-
visit spree.root_path
|
113
|
-
click_link "E-11"
|
114
|
-
click_button "Add To Cart"
|
115
|
-
within("#cart_adjustments") do
|
116
|
-
expect(page).to have_content("-$15.00")
|
117
|
-
end
|
118
|
-
|
119
|
-
# Reduce quantity of first item to 2
|
120
|
-
fill_in "order_line_items_attributes_0_quantity", with: 2
|
121
|
-
click_button "Update"
|
122
|
-
within("#cart_adjustments") do
|
123
|
-
expect(page).to have_content("-$15.00")
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
@@ -1,135 +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 'meta tags and title' do
|
30
|
-
it 'displays metas' do
|
31
|
-
t_shirts.update_attributes metas
|
32
|
-
visit '/t/category/super-clothing/t-shirts'
|
33
|
-
expect(page).to have_meta(:description, 'Brand new Ruby on Rails TShirts')
|
34
|
-
expect(page).to have_meta(:keywords, 'ror, tshirt, ruby')
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'display title if set' do
|
38
|
-
t_shirts.update_attributes metas
|
39
|
-
visit '/t/category/super-clothing/t-shirts'
|
40
|
-
expect(page).to have_title("Ruby On Rails TShirt")
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'displays title from taxon root and taxon name' do
|
44
|
-
visit '/t/category/super-clothing/t-shirts'
|
45
|
-
expect(page).to have_title('Category - T-Shirts - ' + store_name)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Regression test for #2814
|
49
|
-
it "doesn't use meta_title as heading on page" do
|
50
|
-
t_shirts.update_attributes metas
|
51
|
-
visit '/t/category/super-clothing/t-shirts'
|
52
|
-
within("h1.taxon-title") do
|
53
|
-
expect(page).to have_content(t_shirts.name)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'uses taxon name in title when meta_title set to empty string' do
|
58
|
-
t_shirts.update_attributes meta_title: ''
|
59
|
-
visit '/t/category/super-clothing/t-shirts'
|
60
|
-
expect(page).to have_title('Category - T-Shirts - ' + store_name)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context "taxon pages" do
|
65
|
-
include_context "custom products"
|
66
|
-
before do
|
67
|
-
visit spree.root_path
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should be able to visit brand Ruby on Rails" do
|
71
|
-
within(:css, '#taxonomies') { click_link "Ruby on Rails" }
|
72
|
-
|
73
|
-
expect(page.all('ul.product-listing li').size).to eq(7)
|
74
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
75
|
-
tmp.delete("")
|
76
|
-
array = ["Ruby on Rails Bag",
|
77
|
-
"Ruby on Rails Baseball Jersey",
|
78
|
-
"Ruby on Rails Jr. Spaghetti",
|
79
|
-
"Ruby on Rails Mug",
|
80
|
-
"Ruby on Rails Ringer T-Shirt",
|
81
|
-
"Ruby on Rails Stein",
|
82
|
-
"Ruby on Rails Tote"]
|
83
|
-
expect(tmp.sort!).to eq(array)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should be able to visit brand Ruby" do
|
87
|
-
within(:css, '#taxonomies') { click_link "Ruby" }
|
88
|
-
|
89
|
-
expect(page.all('ul.product-listing li').size).to eq(1)
|
90
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
91
|
-
tmp.delete("")
|
92
|
-
expect(tmp.sort!).to eq(["Ruby Baseball Jersey"])
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should be able to visit brand Apache" do
|
96
|
-
within(:css, '#taxonomies') { click_link "Apache" }
|
97
|
-
|
98
|
-
expect(page.all('ul.product-listing li').size).to eq(1)
|
99
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
100
|
-
tmp.delete("")
|
101
|
-
expect(tmp.sort!).to eq(["Apache Baseball Jersey"])
|
102
|
-
end
|
103
|
-
|
104
|
-
it "should be able to visit category Clothing" do
|
105
|
-
click_link "Clothing"
|
106
|
-
|
107
|
-
expect(page.all('ul.product-listing li').size).to eq(5)
|
108
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
109
|
-
tmp.delete("")
|
110
|
-
expect(tmp.sort!).to eq(["Apache Baseball Jersey",
|
111
|
-
"Ruby Baseball Jersey",
|
112
|
-
"Ruby on Rails Baseball Jersey",
|
113
|
-
"Ruby on Rails Jr. Spaghetti",
|
114
|
-
"Ruby on Rails Ringer T-Shirt"])
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should be able to visit category Mugs" do
|
118
|
-
click_link "Mugs"
|
119
|
-
|
120
|
-
expect(page.all('ul.product-listing li').size).to eq(2)
|
121
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
122
|
-
tmp.delete("")
|
123
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein"])
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should be able to visit category Bags" do
|
127
|
-
click_link "Bags"
|
128
|
-
|
129
|
-
expect(page.all('ul.product-listing li').size).to eq(2)
|
130
|
-
tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
|
131
|
-
tmp.delete("")
|
132
|
-
expect(tmp.sort!).to eq(["Ruby on Rails Bag", "Ruby on Rails Tote"])
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|