workarea-storefront 3.5.22 → 3.5.23

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: 66101812b1f0676a1796e9720977fc6e59157b7b5aeb56fdc6cc20a924e229cc
4
- data.tar.gz: 3e7253564b097f133a64b3e415f33933644fddd9f17ba7c7d73301e11db61d49
3
+ metadata.gz: b1da1deb30c161dd030c597ff2f756e7cada539898349cc1b69e792963300ff4
4
+ data.tar.gz: d1097a4b6978e1ea04f5b569d52540502f24b1b8251a2191289b25bc6ade1190
5
5
  SHA512:
6
- metadata.gz: aff1862d9056bfe554107798fcac8ff339a8e11ba2d1273b85b774c803f32ece76410079096d8ac26d22340deba567a74e9dca740b92d47a41aae5ed5ae6b56a
7
- data.tar.gz: f2e8b3de82f8bd49f3b3a3fd23ce371f70bf3defc16f7326bb65f192e4a3155bc6b9dce186694c5d3164361e80b6f8386227b897fa3218047e0c050a32004ceb
6
+ metadata.gz: 66203f30dd011929002a066087c4d000bfe0a86e246b72f08fd2487a6d3cd6af4733f367ecf531969a786e1d671991a8188c2eba2fe9beaf3379e001ab1e881d
7
+ data.tar.gz: 9fcbcfce3d4df843a4bdcea43d90022f269314a8ccae27d23af2c99982bf0b255e4fad67304c0a87448e60d5553968cd270703b3c6f27a00be504ddf8f98b853
@@ -11,13 +11,14 @@ module Workarea
11
11
  after_action :check_inventory, except: :create
12
12
 
13
13
  def create
14
+ @cart = CartViewModel.new(current_order, view_model_options)
15
+
14
16
  # TODO: for v4, use AddItemToCart for this.
15
17
  if current_order.add_item(item_params.to_h.merge(item_details.to_h))
16
18
  check_inventory
17
19
 
18
20
  Pricing.perform(current_order, current_shippings)
19
21
 
20
- @cart = CartViewModel.new(current_order, view_model_options)
21
22
  @item = OrderItemViewModel.wrap(
22
23
  current_order.items.find_existing(
23
24
  item_params[:sku],
@@ -10,6 +10,8 @@ module Workarea
10
10
  else
11
11
  new(model, options)
12
12
  end
13
+ rescue NameError
14
+ new(model, options)
13
15
  end
14
16
 
15
17
  def breadcrumbs
@@ -47,6 +47,18 @@ module Workarea
47
47
  assert_equal(5.to_m, order.items.first.total_price)
48
48
  end
49
49
 
50
+ def test_fail_to_add_an_item
51
+ post storefront.cart_items_path,
52
+ params: {
53
+ product_id: @product.id,
54
+ sku: 'SKU1',
55
+ quantity: -1
56
+ }
57
+
58
+ assert_response(:success)
59
+ assert_empty(Order.all)
60
+ end
61
+
50
62
  def test_adding_product_with_shared_skus
51
63
  product_2 = Catalog::Product.create!(name: 'Product', variants: [{ sku: 'SKU1' }])
52
64
 
@@ -15,6 +15,14 @@ module Workarea
15
15
  view_model = ProductViewModel.wrap(@product, one: '1')
16
16
  assert_instance_of(ProductTemplates::OptionSelectsViewModel, view_model)
17
17
  assert_equal('1', view_model.options[:one])
18
+
19
+ Workarea.with_config do |config|
20
+ config.product_templates << :no_view_model
21
+ @product.template = 'no_view_model'
22
+ view_model = ProductViewModel.wrap(@product, one: '1')
23
+
24
+ assert_kind_of(ProductViewModel, view_model)
25
+ end
18
26
  end
19
27
 
20
28
  def test_cache_key
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.22
4
+ version: 3.5.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-03 00:00:00.000000000 Z
11
+ date: 2020-11-25 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.22
19
+ version: 3.5.23
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.22
26
+ version: 3.5.23
27
27
  description: Provides user-facing ecommerce storefront functionality for the Workarea
28
28
  Commerce Platform.
29
29
  email: