workarea-storefront 3.5.0.beta.1 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fc7579774a32bc9746b0213537251f654ade0cb5cfa5764b7a80e211cc457d2
4
- data.tar.gz: 640c178f253dc782cf057823ed1ca695b8fc80d17d1fb2fca58f512c6381b4dd
3
+ metadata.gz: d693a55944192cf23fd6341859c366277a01988b2b5ff34040183828ca6c12c7
4
+ data.tar.gz: 1e6c57484728ebca2384547e5e4ccd1dfceae3847eac886e3bb1f28c342758e8
5
5
  SHA512:
6
- metadata.gz: 6682f2b247acfc7eab72935986f0e58f634f1e2ee903203cda187aca005bcdfc209b624b64da25550f07eb46320df539ebe3a7b6662ccf0718a23a01220d59e2
7
- data.tar.gz: b29492053eaeb0185cdb11f61b2efc777df1da1e0f855c5ed4b155d914b51480a8b1755108b63bb69c7feea8605cb51a40674dd97fe0e78f1bf1a18450302853
6
+ metadata.gz: 7764b11b9cd1ed0f1b62ded7893a4bed21c8d7ae847a6a578f0a39252b09a9334a84a3fcc00f3a9c236ea6ee70fc24158fe0f5b9a7a23ea2ca37f9ff890c9b7c
7
+ data.tar.gz: 2187e4020b5486ae615e93860cc6015d62aa65925517130fd1181a418bd6bfae70bccc5616e6774224d66a3e50928bab1e0f84fa0ccdcf87decec153d5d8fa73
@@ -6,7 +6,6 @@ module Workarea
6
6
  include CurrentCheckout
7
7
  include CurrentRelease
8
8
  include OrderLookup
9
- include CurrentReferrer
10
9
 
11
10
  layout :current_layout
12
11
 
@@ -192,9 +192,9 @@ module Workarea
192
192
  if current_variant.present?
193
193
  fulfillment_skus
194
194
  .detect { |sku| sku.id == current_variant.sku }
195
- .requires_shipping?
195
+ .shipping?
196
196
  else
197
- fulfillment_skus.any?(&:requires_shipping?)
197
+ fulfillment_skus.any?(&:shipping?)
198
198
  end
199
199
  end
200
200
  end
@@ -74,7 +74,7 @@ module Workarea
74
74
  assert_equal('Crouse', credit_card.last_name)
75
75
  assert_equal('XXXX-XXXX-XXXX-1', credit_card.display_number)
76
76
  assert_equal(1, credit_card.month)
77
- assert_equal(2020, credit_card.year)
77
+ assert_equal(next_year, credit_card.year)
78
78
  refute(credit_card.token.blank?)
79
79
 
80
80
  complete_checkout('bcrouse@workarea.com', 'W3bl1nc!')
@@ -182,7 +182,7 @@ module Workarea
182
182
  credit_card: {
183
183
  number: '2',
184
184
  month: 1,
185
- year: 2020,
185
+ year: next_year,
186
186
  cvv: '999'
187
187
  }
188
188
  }
@@ -19,7 +19,7 @@ module Workarea
19
19
  assert_equal(1, token.reload.downloads)
20
20
 
21
21
  token.update!(enabled: true)
22
- sku.update!(policy: 'ignore')
22
+ sku.update!(policy: 'shipping')
23
23
 
24
24
  get storefront.download_path(token)
25
25
  assert_redirected_to(storefront.root_path)
@@ -69,7 +69,7 @@ module Workarea
69
69
  credit_card: {
70
70
  number: '1',
71
71
  month: 1,
72
- year: 2020,
72
+ year: next_year,
73
73
  cvv: '999'
74
74
  }
75
75
  }
@@ -100,7 +100,7 @@ module Workarea
100
100
  assert_equal('Test Card', payment.credit_card.issuer)
101
101
  assert_equal('XXXX-XXXX-XXXX-1', payment.credit_card.display_number)
102
102
  assert_equal(1, payment.credit_card.month)
103
- assert_equal(2020, payment.credit_card.year)
103
+ assert_equal(next_year, payment.credit_card.year)
104
104
  refute(payment.credit_card.token.blank?)
105
105
  assert(payment.credit_card.saved_card_id.blank?)
106
106
 
@@ -66,7 +66,7 @@ module Workarea
66
66
  credit_card: {
67
67
  number: '1',
68
68
  month: 1,
69
- year: 2020,
69
+ year: next_year,
70
70
  cvv: '999'
71
71
  }
72
72
  }
@@ -81,7 +81,7 @@ module Workarea
81
81
  credit_card: {
82
82
  number: '2',
83
83
  month: 1,
84
- year: 2020,
84
+ year: next_year,
85
85
  cvv: '999'
86
86
  }
87
87
  }
@@ -97,7 +97,7 @@ module Workarea
97
97
  credit_card: {
98
98
  number: '1',
99
99
  month: 1,
100
- year: 2020,
100
+ year: next_year,
101
101
  cvv: '999'
102
102
  }
103
103
  }
@@ -117,7 +117,7 @@ module Workarea
117
117
  credit_card: {
118
118
  number: '1',
119
119
  month: 1,
120
- year: 2020,
120
+ year: next_year,
121
121
  cvv: '999'
122
122
  }
123
123
  }
@@ -76,7 +76,7 @@ module Workarea
76
76
  credit_card: {
77
77
  number: '1',
78
78
  month: 1,
79
- year: 2020,
79
+ year: next_year,
80
80
  cvv: '999'
81
81
  }
82
82
  }
@@ -245,6 +245,32 @@ module Workarea
245
245
  refute_match(/public/, response.headers['Cache-Control'])
246
246
  assert_equal('true', response.headers['X-Workarea-Segmented-Content'])
247
247
  end
248
+
249
+ def test_referrer_based_segments
250
+ google = create_segment(rules: [Segment::Rules::TrafficReferrer.new(source: %w(Google))])
251
+ facebook = create_segment(rules: [Segment::Rules::TrafficReferrer.new(url: 'facebook')])
252
+
253
+ get storefront.current_user_path(format: 'json'),
254
+ headers: { 'HTTP_REFERER' => 'https://www.google.com/' }
255
+ assert_equal(google.id.to_s, response.headers['X-Workarea-Segments'])
256
+
257
+ get storefront.current_user_path(format: 'json'),
258
+ headers: { 'HTTP_REFERER' => 'https://www.facebook.com/' }
259
+ assert_equal(facebook.id.to_s, response.headers['X-Workarea-Segments'])
260
+
261
+ cookies[:workarea_referrer] = 'https://www.google.com/'
262
+ get storefront.current_user_path(format: 'json')
263
+ assert_equal(google.id.to_s, response.headers['X-Workarea-Segments'])
264
+
265
+ cookies[:workarea_referrer] = 'https://www.facebook.com/'
266
+ get storefront.current_user_path(format: 'json')
267
+ assert_equal(facebook.id.to_s, response.headers['X-Workarea-Segments'])
268
+
269
+ cookies[:workarea_referrer] = 'https://www.google.com/'
270
+ get storefront.current_user_path(format: 'json'),
271
+ headers: { 'HTTP_REFERER' => 'https://www.facebook.com/' }
272
+ assert_equal(google.id.to_s, response.headers['X-Workarea-Segments'])
273
+ end
248
274
  end
249
275
  end
250
276
  end
@@ -98,7 +98,7 @@ module Workarea
98
98
  assert_equal('Test Card', payment.credit_card.issuer)
99
99
  assert_equal('XXXX-XXXX-XXXX-1', payment.credit_card.display_number)
100
100
  assert_equal(1, payment.credit_card.month)
101
- assert_equal(2020, payment.credit_card.year)
101
+ assert_equal(next_year, payment.credit_card.year)
102
102
  assert_equal(13.19.to_m, payment.credit_card.amount)
103
103
  refute(payment.credit_card.token.blank?)
104
104
  assert_equal(1, payment.credit_card.transactions.length)
@@ -49,14 +49,14 @@ module Workarea
49
49
  params: {
50
50
  credit_card: {
51
51
  month: '2',
52
- year: '2020',
52
+ year: next_year.to_s,
53
53
  cvv: '999'
54
54
  }
55
55
  }
56
56
 
57
57
  credit_card.reload
58
58
  assert_equal(2, credit_card.month)
59
- assert_equal(2020, credit_card.year)
59
+ assert_equal(next_year, credit_card.year)
60
60
  end
61
61
 
62
62
  def test_removes_credit_cards
@@ -233,8 +233,8 @@ module Workarea
233
233
 
234
234
  def test_requires_shipping?
235
235
  product = create_product(variants: [{ sku: 'SKU1' }, { sku: 'SKU2' }])
236
- sku_1 = create_fulfillment_sku(id: 'SKU1', policy: 'ignore')
237
- sku_2 = create_fulfillment_sku(id: 'SKU2', policy: 'ship')
236
+ sku_1 = create_fulfillment_sku(id: 'SKU1', policy: 'download', file: product_image_file)
237
+ sku_2 = create_fulfillment_sku(id: 'SKU2', policy: 'shipping')
238
238
 
239
239
  view_model = ProductViewModel.wrap(product)
240
240
  assert(view_model.requires_shipping?)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-storefront
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0.beta.1
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2019-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.5.0.beta.1
19
+ version: 3.5.0
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.5.0.beta.1
26
+ version: 3.5.0
27
27
  description: Provides user-facing ecommerce storefront functionality for the Workarea
28
28
  Commerce Platform.
29
29
  email:
@@ -657,7 +657,6 @@ files:
657
657
  - test/system/workarea/storefront/content_system_test.rb
658
658
  - test/system/workarea/storefront/credit_cards_system_test.rb
659
659
  - test/system/workarea/storefront/customer_service_system_test.rb
660
- - test/system/workarea/storefront/digital_products_system_test.rb
661
660
  - test/system/workarea/storefront/discounting_multiple_system_test.rb
662
661
  - test/system/workarea/storefront/discounting_system_test.rb
663
662
  - test/system/workarea/storefront/download_system_test.rb
@@ -730,9 +729,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
730
729
  version: '0'
731
730
  required_rubygems_version: !ruby/object:Gem::Requirement
732
731
  requirements:
733
- - - ">"
732
+ - - ">="
734
733
  - !ruby/object:Gem::Version
735
- version: 1.3.1
734
+ version: '0'
736
735
  requirements: []
737
736
  rubygems_version: 3.0.6
738
737
  signing_key:
@@ -1,142 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Workarea
4
- module Storefront
5
- # TODO: delete this for v3.6
6
- # Leaving this in v3.5 for compatibility with existing builds
7
- class DigitalProductsSystemTest < Workarea::SystemTest
8
- include Storefront::SystemTest
9
-
10
- def test_checking_out_with_a_digital_product
11
- setup_checkout_specs
12
-
13
- Order.first.items.delete_all
14
-
15
- product = create_product(
16
- name: 'Digital Product',
17
- digital: true,
18
- variants: [
19
- { sku: 'SKU1', regular: 10.to_m },
20
- { sku: 'SKU2', regular: 15.to_m },
21
- { sku: 'SKU3', regular: 25.to_m }
22
- ]
23
- )
24
-
25
- visit storefront.product_path(product)
26
-
27
- within '.product-details__add-to-cart-form' do
28
- select product.skus.first, from: 'sku'
29
- click_button t('workarea.storefront.products.add_to_cart')
30
- end
31
-
32
- assert(page.has_content?('Success'))
33
-
34
- start_guest_checkout
35
-
36
- assert_current_path(storefront.checkout_addresses_path)
37
-
38
- fill_in_email
39
- fill_in_billing_address
40
- click_button t('workarea.storefront.checkouts.continue_to_payment')
41
-
42
- assert_current_path(storefront.checkout_payment_path)
43
- assert(page.has_content?('Success'))
44
-
45
- fill_in_credit_card
46
- click_button t('workarea.storefront.checkouts.place_order')
47
-
48
- assert_current_path(storefront.checkout_confirmation_path)
49
- assert(page.has_content?('Success'))
50
- assert(page.has_content?(t('workarea.storefront.flash_messages.order_placed')))
51
- assert(page.has_content?(Order.first.id))
52
-
53
- assert(page.has_content?('1019 S. 47th St.'))
54
- assert(page.has_content?('Philadelphia'))
55
- assert(page.has_content?('PA'))
56
- assert(page.has_content?('19143'))
57
-
58
- assert(page.has_content?('Test Card'))
59
- assert(page.has_content?('XX-1'))
60
-
61
- assert(page.has_content?('Digital Product'))
62
- assert(page.has_content?('$10.00'))
63
- end
64
-
65
- def test_order_not_requiring_shipping
66
- setup_checkout_specs
67
- start_guest_checkout
68
-
69
- create_shipping_service(
70
- name: 'Next Day',
71
- tax_code: '001',
72
- rates: [{ price: 20.to_m }]
73
- )
74
-
75
- assert_current_path(storefront.checkout_addresses_path)
76
- fill_in_email
77
- fill_in_shipping_address
78
-
79
- uncheck 'same_as_shipping'
80
- fill_in_billing_address
81
-
82
- click_button t('workarea.storefront.checkouts.continue_to_shipping')
83
-
84
- assert_current_path(storefront.checkout_shipping_path)
85
- click_button t('workarea.storefront.checkouts.continue_to_payment')
86
-
87
- assert_current_path(storefront.checkout_payment_path)
88
- assert(page.has_content?('Success'))
89
-
90
- visit storefront.checkout_shipping_path
91
- choose "shipping_service_Next_Day"
92
- click_button t('workarea.storefront.checkouts.continue_to_payment')
93
-
94
- assert_current_path(storefront.checkout_payment_path)
95
- assert(page.has_content?('Success'))
96
-
97
- # switch to digital product
98
-
99
- Order.first.items.delete_all
100
-
101
- product = create_product(
102
- name: 'Digital Product',
103
- digital: true,
104
- variants: [
105
- { sku: 'SKU1', regular: 10.to_m },
106
- { sku: 'SKU2', regular: 15.to_m },
107
- { sku: 'SKU3', regular: 25.to_m }
108
- ]
109
- )
110
-
111
- visit storefront.product_path(product)
112
-
113
- within '.product-details__add-to-cart-form' do
114
- select product.skus.first, from: 'sku'
115
- click_button t('workarea.storefront.products.add_to_cart')
116
- end
117
-
118
- click_link t('workarea.storefront.carts.checkout')
119
-
120
- assert_current_path(storefront.checkout_addresses_path)
121
-
122
- fill_in_email
123
- fill_in_billing_address
124
- click_button t('workarea.storefront.checkouts.continue_to_payment')
125
-
126
- assert_current_path(storefront.checkout_payment_path)
127
- assert(page.has_content?('Success'))
128
-
129
- assert(page.has_content?('1019 S. 47th St.'))
130
- assert(page.has_content?('Philadelphia'))
131
- assert(page.has_content?('PA'))
132
- assert(page.has_content?('19143'))
133
-
134
- assert(page.has_no_content?("#{t('workarea.storefront.orders.tax')} $1.40"))
135
- assert(page.has_no_content?("#{t('workarea.storefront.orders.total')} $31.40"))
136
- assert(page.has_content?("#{t('workarea.storefront.orders.shipping')} #{t('workarea.storefront.checkouts.not_applicable')}"))
137
- assert(page.has_content?("#{t('workarea.storefront.orders.tax')} $0.00"))
138
- assert(page.has_content?("#{t('workarea.storefront.orders.total')} $10.00"))
139
- end
140
- end
141
- end
142
- end