workarea-api-admin 4.5.3 → 4.5.4

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: 7ade0de2d9f503a08af8e518811ef80a75d0df828dd2ee0584ef315921304b33
4
- data.tar.gz: 4e9137dc168f7199167e5d5db9e7c69b9419d697d7082b496e33e58afed5de83
3
+ metadata.gz: 81c2568b51d648907bd12c63596d693fd7e0891188eba09f44986ebe7f03aed5
4
+ data.tar.gz: 9b3810180b668eb59f17e6d27ed92890710d442bd335de7fa572ce45b4e917c4
5
5
  SHA512:
6
- metadata.gz: eede0286c44906edcba9ed5692e6157316162036543b9be86e1979bab7268450f224bd3d00d9fac6f973ac47ae1302f4a81a2d0ee123cafb1ea1e3f247474da4
7
- data.tar.gz: dc3c936ee652efaa599ef24671ff94790ec47babeb4d71223c39c08df426193f0ded6bfe1efd0b46327bfafb78ba35bf14d8e592cb6dab60c6ad7a453d0add5b
6
+ metadata.gz: f857a9f9dc07e1b46b1788b0afc7a240e9b60fb456afa8301fb254ccbee21957c47585ee8fd822784da4e9f0e1d80bcde07c3e87a75b761119c48bdf1f777434
7
+ data.tar.gz: 8d2d3759c8a290d4d309152c02c9988ab296a6be01bdf4490f7d53e28515c9ddf4aa6df87e6d7fe35369c15dd48d62e060b2a5bfa56636c0585510b7a042b60e
@@ -114,7 +114,7 @@ module Workarea
114
114
  private
115
115
 
116
116
  def find_recommendation_settings
117
- @recommendation_settings = Recommendation::Settings.find(params[:product_id])
117
+ @recommendation_settings = Recommendation::Settings.find_or_initialize_by(id: params[:product_id])
118
118
  end
119
119
  end
120
120
  end
@@ -35,6 +35,20 @@ module Workarea
35
35
 
36
36
  assert_equal(['foo'], recommendation_settings.reload.product_ids)
37
37
  end
38
+
39
+ def test_unpersisted_recommendation_settings
40
+ get admin_api.product_recommendation_settings_path(@product.id)
41
+ result = JSON.parse(response.body)['recommendation_settings']
42
+ assert_equal(@product.id, result['_id'])
43
+ assert_equal(0, Recommendation::Settings.count)
44
+
45
+ patch admin_api.product_recommendation_settings_path(@product.id),
46
+ params: { recommendation_settings: { product_ids: ['foo'] } }
47
+
48
+ assert_equal(1, Recommendation::Settings.count)
49
+ assert_equal(@product.id, Recommendation::Settings.first.id)
50
+ assert_equal(['foo'], Recommendation::Settings.first.product_ids)
51
+ end
38
52
  end
39
53
  end
40
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-api-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.3
4
+ version: 4.5.4
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-03-26 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
250
  - !ruby/object:Gem::Version
251
251
  version: '0'
252
252
  requirements: []
253
- rubygems_version: 3.0.6
253
+ rubygems_version: 3.0.3
254
254
  signing_key:
255
255
  specification_version: 4
256
256
  summary: Admin JSON REST API for the Workarea Commerce Platform