spree_frontend 3.0.10 → 3.1.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/spree/frontend.js +3 -0
  4. data/app/assets/javascripts/spree/frontend/checkout.js.coffee +12 -7
  5. data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +5 -3
  6. data/app/assets/javascripts/spree/frontend/product.js.coffee +11 -4
  7. data/app/assets/stylesheets/spree/frontend.css +0 -1
  8. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +2 -2
  9. data/app/controllers/spree/checkout_controller.rb +17 -1
  10. data/app/controllers/spree/home_controller.rb +1 -1
  11. data/app/controllers/spree/orders_controller.rb +4 -2
  12. data/app/controllers/spree/products_controller.rb +7 -4
  13. data/app/controllers/spree/store_controller.rb +23 -18
  14. data/app/controllers/spree/taxons_controller.rb +1 -6
  15. data/app/helpers/spree/frontend_helper.rb +3 -2
  16. data/app/helpers/spree/taxons_helper.rb +3 -2
  17. data/app/views/spree/address/_form.html.erb +28 -15
  18. data/app/views/spree/checkout/_payment.html.erb +3 -2
  19. data/app/views/spree/checkout/_summary.html.erb +7 -0
  20. data/app/views/spree/checkout/edit.html.erb +3 -1
  21. data/app/views/spree/checkout/payment/_gateway.html.erb +13 -5
  22. data/app/views/spree/checkout/payment/_storecredit.html.erb +16 -0
  23. data/app/views/spree/payments/_payment.html.erb +2 -0
  24. data/app/views/spree/products/_cart_form.html.erb +24 -15
  25. data/app/views/spree/products/_taxons.html.erb +7 -11
  26. data/app/views/spree/products/show.html.erb +8 -6
  27. data/app/views/spree/shared/_filters.html.erb +1 -1
  28. data/app/views/spree/shared/_header.html.erb +1 -1
  29. data/app/views/spree/shared/_nav_bar.html.erb +1 -1
  30. data/app/views/spree/shared/_order_details.html.erb +6 -6
  31. data/app/views/spree/shared/_products.html.erb +12 -14
  32. data/app/views/spree/shared/forbidden.html.erb +0 -0
  33. data/config/routes.rb +15 -19
  34. data/spec/controllers/controller_helpers_spec.rb +102 -6
  35. data/spec/controllers/spree/checkout_controller_spec.rb +7 -0
  36. data/spec/features/checkout_spec.rb +223 -165
  37. data/spec/features/checkout_unshippable_spec.rb +1 -1
  38. data/spec/features/microdata_spec.rb +0 -0
  39. data/spec/features/products_spec.rb +79 -7
  40. data/spec/helpers/frontend_helper_spec.rb +16 -0
  41. data/spec/spec_helper.rb +1 -0
  42. metadata +13 -10
  43. data/CHANGELOG.md +0 -1
@@ -14,7 +14,7 @@ describe "checkout with unshippable items", type: :feature, inaccessible: true d
14
14
 
15
15
  user = create(:user)
16
16
  order.user = user
17
- order.update!
17
+ order.update_with_updater!
18
18
 
19
19
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(:current_order => order)
20
20
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(:try_spree_current_user => user)
File without changes
@@ -20,6 +20,23 @@ describe "Visiting Products", type: :feature, inaccessible: true do
20
20
  expect(page).to have_content("Shopping Cart")
21
21
  end
22
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 ["http://www.example.com/products/ruby-on-rails-ringer-t-shirt"]
37
+ end
38
+ end
39
+
23
40
  describe 'meta tags and title' do
24
41
  let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
25
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' } }
@@ -124,7 +141,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
124
141
  context "a product with variants" do
125
142
  let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
126
143
  let(:option_value) { create(:option_value) }
127
- let!(:variant) { product.variants.create!(:price => 5.59) }
144
+ let!(:variant) { build(:variant, price: 5.59, product: product, option_values: []) }
128
145
 
129
146
  before do
130
147
  # Need to have two images to trigger the error
@@ -134,6 +151,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
134
151
 
135
152
  product.option_types << option_value.option_type
136
153
  variant.option_values << option_value
154
+ variant.save!
137
155
  end
138
156
 
139
157
  it "should be displayed" do
@@ -156,17 +174,26 @@ describe "Visiting Products", type: :feature, inaccessible: true do
156
174
  expect(page).not_to have_content Spree.t(:out_of_stock)
157
175
  end
158
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
159
186
  end
160
187
 
161
188
  context "a product with variants, images only for the variants" do
162
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) }
163
192
 
164
193
  before do
165
194
  image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
166
- v1 = product.variants.create!(price: 9.99)
167
- v2 = product.variants.create!(price: 10.99)
168
- v1.images.create!(attachment: image)
169
- v2.images.create!(attachment: image)
195
+ variant1.images.create!(attachment: image)
196
+ variant2.images.create!(attachment: image)
170
197
  end
171
198
 
172
199
  it "should not display no image available" do
@@ -175,6 +202,51 @@ describe "Visiting Products", type: :feature, inaccessible: true do
175
202
  end
176
203
  end
177
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
+
178
250
  it "should be able to hide products without price" do
179
251
  expect(page.all('#products .product-list-item').size).to eq(9)
180
252
  Spree::Config.show_products_without_price = false
@@ -209,11 +281,11 @@ describe "Visiting Products", type: :feature, inaccessible: true do
209
281
  within(:css, '#sidebar_products_search') { click_button "Search" }
210
282
 
211
283
  expect(page.all('#products .product-list-item').size).to eq(2)
212
- products = page.all('#products .product-list-item a[itemprop=name]')
284
+ products = page.all('#products .product-list-item span[itemprop=name]')
213
285
  expect(products.count).to eq(2)
214
286
 
215
287
  find('.pagination .next a').click
216
- products = page.all('#products .product-list-item a[itemprop=name]')
288
+ products = page.all('#products .product-list-item span[itemprop=name]')
217
289
  expect(products.count).to eq(1)
218
290
  end
219
291
 
@@ -37,5 +37,21 @@ module Spree
37
37
  taxon = create(:taxon, name: "iphone")
38
38
  expect(spree.nested_taxons_path(taxon)).to eq("/t/iphone")
39
39
  end
40
+
41
+ context '#checkout_progress' do
42
+ before do
43
+ @order = create(:order, state: 'address')
44
+ end
45
+
46
+ it 'does not include numbers by default' do
47
+ output = checkout_progress
48
+ expect(output).to_not include('1.')
49
+ end
50
+
51
+ it 'has option to include numbers' do
52
+ output = checkout_progress(numbers: true)
53
+ expect(output).to include('1.')
54
+ end
55
+ end
40
56
  end
41
57
  end
data/spec/spec_helper.rb CHANGED
@@ -45,6 +45,7 @@ require 'spree/testing_support/url_helpers'
45
45
  require 'spree/testing_support/order_walkthrough'
46
46
  require 'spree/testing_support/caching'
47
47
  require 'spree/testing_support/shoulda_matcher_configuration'
48
+ require 'spree/testing_support/microdata'
48
49
 
49
50
  require 'paperclip/matchers'
50
51
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.10
4
+ version: 3.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-16 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.10
19
+ version: 3.1.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.10
26
+ version: 3.1.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.10
33
+ version: 3.1.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.10
40
+ version: 3.1.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -106,7 +106,6 @@ executables: []
106
106
  extensions: []
107
107
  extra_rdoc_files: []
108
108
  files:
109
- - CHANGELOG.md
110
109
  - Gemfile
111
110
  - LICENSE
112
111
  - README.md
@@ -421,6 +420,7 @@ files:
421
420
  - app/views/spree/checkout/edit.html.erb
422
421
  - app/views/spree/checkout/payment/_check.html.erb
423
422
  - app/views/spree/checkout/payment/_gateway.html.erb
423
+ - app/views/spree/checkout/payment/_storecredit.html.erb
424
424
  - app/views/spree/content/cvv.html.erb
425
425
  - app/views/spree/content/test.html.erb
426
426
  - app/views/spree/home/index.html.erb
@@ -460,6 +460,7 @@ files:
460
460
  - app/views/spree/shared/_shipment_tracking.html.erb
461
461
  - app/views/spree/shared/_sidebar.html.erb
462
462
  - app/views/spree/shared/_taxonomies.html.erb
463
+ - app/views/spree/shared/forbidden.html.erb
463
464
  - app/views/spree/shared/unauthorized.html.erb
464
465
  - app/views/spree/store/cart_link.html.erb
465
466
  - app/views/spree/taxons/_taxon.html.erb
@@ -498,6 +499,7 @@ files:
498
499
  - spec/features/currency_spec.rb
499
500
  - spec/features/free_shipping_promotions_spec.rb
500
501
  - spec/features/locale_spec.rb
502
+ - spec/features/microdata_spec.rb
501
503
  - spec/features/order_spec.rb
502
504
  - spec/features/page_promotions_spec.rb
503
505
  - spec/features/products_spec.rb
@@ -578,13 +580,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
578
580
  version: '0'
579
581
  required_rubygems_version: !ruby/object:Gem::Requirement
580
582
  requirements:
581
- - - ">="
583
+ - - ">"
582
584
  - !ruby/object:Gem::Version
583
- version: '0'
585
+ version: 1.3.1
584
586
  requirements:
585
587
  - none
586
588
  rubyforge_project:
587
- rubygems_version: 2.5.1
589
+ rubygems_version: 2.4.8
588
590
  signing_key:
589
591
  specification_version: 4
590
592
  summary: Frontend e-commerce functionality for the Spree project.
@@ -612,6 +614,7 @@ test_files:
612
614
  - spec/features/currency_spec.rb
613
615
  - spec/features/free_shipping_promotions_spec.rb
614
616
  - spec/features/locale_spec.rb
617
+ - spec/features/microdata_spec.rb
615
618
  - spec/features/order_spec.rb
616
619
  - spec/features/page_promotions_spec.rb
617
620
  - spec/features/products_spec.rb
data/CHANGELOG.md DELETED
@@ -1 +0,0 @@
1
- ## Spree 3.0.0 (unreleased) ##