workarea-core 3.5.12 → 3.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/mailers/workarea/application_mailer.rb +4 -1
- data/app/models/workarea/checkout.rb +7 -7
- data/app/models/workarea/data_file/csv.rb +9 -1
- data/app/models/workarea/inquiry.rb +2 -1
- data/app/models/workarea/inventory/sku.rb +2 -2
- data/app/models/workarea/metrics/user.rb +24 -8
- data/app/models/workarea/order.rb +13 -3
- data/app/models/workarea/payment.rb +1 -6
- data/app/models/workarea/releasable.rb +3 -1
- data/app/models/workarea/release/changeset.rb +1 -0
- data/app/models/workarea/search/admin/pricing_discount.rb +1 -1
- data/app/models/workarea/search/storefront.rb +9 -1
- data/app/models/workarea/search/storefront/category_query.rb +1 -1
- data/app/models/workarea/search/storefront/product.rb +11 -2
- data/app/queries/workarea/product_releases.rb +6 -0
- data/app/services/workarea/direct_upload.rb +6 -1
- data/app/services/workarea/index_release_schedule_previews.rb +37 -0
- data/app/workers/workarea/index_category_changes.rb +16 -3
- data/app/workers/workarea/index_release_schedule_change.rb +32 -0
- data/app/workers/workarea/publish_release.rb +1 -0
- data/config/locales/en.yml +2 -0
- data/lib/generators/workarea/install/install_generator.rb +13 -0
- data/lib/generators/workarea/install/templates/initializer.rb.erb +1 -1
- data/lib/tasks/search.rake +10 -4
- data/lib/workarea/configuration.rb +11 -0
- data/lib/workarea/configuration/administrable_options.rb +1 -5
- data/lib/workarea/core.rb +2 -0
- data/lib/workarea/ext/jbuilder/jbuilder_cache.rb +29 -0
- data/lib/workarea/queues_pauser.rb +26 -0
- data/lib/workarea/version.rb +1 -1
- data/test/generators/workarea/install_generator_test.rb +6 -0
- data/test/mailers/workarea/application_mailer_test.rb +10 -0
- data/test/models/workarea/checkout_test.rb +57 -0
- data/test/models/workarea/data_file/import_test.rb +40 -0
- data/test/models/workarea/releasable_test.rb +13 -0
- data/test/models/workarea/search/storefront/category_query_test.rb +11 -0
- data/test/models/workarea/search/storefront/product_releases_test.rb +60 -0
- data/test/models/workarea/search/storefront_test.rb +13 -0
- data/test/queries/workarea/search/category_browse_test.rb +23 -0
- data/test/services/workarea/direct_upload_test.rb +20 -0
- data/test/services/workarea/index_release_schedule_previews_test.rb +28 -0
- data/test/workers/workarea/index_release_schedule_change_test.rb +107 -0
- data/test/workers/workarea/publish_release_test.rb +24 -0
- data/workarea-core.gemspec +6 -5
- metadata +33 -13
- data/test/queries/workarea/product_releases_test.rb +0 -56
@@ -112,6 +112,26 @@ module Workarea
|
|
112
112
|
assert(DirectUpload.ensure_cors!('https://example.com/admin/direct_uploads'))
|
113
113
|
end
|
114
114
|
|
115
|
+
def test_ensure_cors_with_no_existing_configuration
|
116
|
+
Workarea.s3.expects(:get_bucket_cors)
|
117
|
+
.raises(Excon::Errors::NotFound.new('CORS configuration does not exist'))
|
118
|
+
|
119
|
+
|
120
|
+
Workarea.s3.expects(:put_bucket_cors).with(
|
121
|
+
Configuration::S3.bucket,
|
122
|
+
'CORSConfiguration' => [
|
123
|
+
{
|
124
|
+
'ID' => "direct_upload_http://test.host",
|
125
|
+
'AllowedMethod' => 'PUT',
|
126
|
+
'AllowedOrigin' => 'http://test.host',
|
127
|
+
'AllowedHeader' => '*'
|
128
|
+
}
|
129
|
+
]
|
130
|
+
).returns(true)
|
131
|
+
|
132
|
+
assert(DirectUpload.ensure_cors!('http://test.host/admin/content_assets'))
|
133
|
+
end
|
134
|
+
|
115
135
|
private
|
116
136
|
|
117
137
|
def upload_file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class IndexReleaseSchedulePreviewsTest < TestCase
|
5
|
+
def test_affected_releases
|
6
|
+
release = create_release
|
7
|
+
results = IndexReleaseSchedulePreviews.new(release: release).affected_releases
|
8
|
+
assert_equal([release], results)
|
9
|
+
|
10
|
+
a = create_release(publish_at: 1.week.from_now)
|
11
|
+
b = create_release(publish_at: 2.weeks.from_now)
|
12
|
+
c = create_release(publish_at: 4.weeks.from_now)
|
13
|
+
assert_equal([a, b, c], IndexReleaseSchedulePreviews.new.affected_releases)
|
14
|
+
|
15
|
+
results = IndexReleaseSchedulePreviews
|
16
|
+
.new(starts_at: 3.days.from_now, ends_at: 17.days.from_now)
|
17
|
+
.affected_releases
|
18
|
+
|
19
|
+
assert_equal([a, b], results)
|
20
|
+
|
21
|
+
results = IndexReleaseSchedulePreviews
|
22
|
+
.new(release: release, starts_at: 3.days.from_now, ends_at: 10.days.from_now)
|
23
|
+
.affected_releases
|
24
|
+
|
25
|
+
assert_equal([a, release], results)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class IndexReleaseScheduleChangeTest < TestCase
|
5
|
+
include TestCase::SearchIndexing
|
6
|
+
|
7
|
+
setup :set_product
|
8
|
+
|
9
|
+
def set_product
|
10
|
+
@product = create_product(name: 'Foo')
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_reschedule
|
14
|
+
a = create_release(name: 'A', publish_at: 1.week.from_now)
|
15
|
+
b = create_release(name: 'B', publish_at: 2.weeks.from_now)
|
16
|
+
c = create_release(name: 'C', publish_at: 4.weeks.from_now)
|
17
|
+
|
18
|
+
b.as_current { @product.update!(name: 'Bar') }
|
19
|
+
IndexProduct.perform(@product)
|
20
|
+
|
21
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
22
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
23
|
+
c.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
24
|
+
|
25
|
+
# Changing publish_at via `update` causes the release to publish due to Sidekiq inline
|
26
|
+
previous_publish_at = b.publish_at
|
27
|
+
b.set(publish_at: 5.weeks.from_now)
|
28
|
+
|
29
|
+
Sidekiq::Callbacks.enable(IndexProduct) do
|
30
|
+
IndexReleaseScheduleChange.new.perform(b.id, previous_publish_at, b.publish_at)
|
31
|
+
end
|
32
|
+
|
33
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
34
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
35
|
+
c.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_removing_from_schedule
|
39
|
+
a = create_release(name: 'A', publish_at: 1.week.from_now)
|
40
|
+
b = create_release(name: 'B', publish_at: 2.weeks.from_now)
|
41
|
+
c = create_release(name: 'C', publish_at: 4.weeks.from_now)
|
42
|
+
|
43
|
+
b.as_current { @product.update!(name: 'Bar') }
|
44
|
+
IndexProduct.perform(@product)
|
45
|
+
|
46
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
47
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
48
|
+
c.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
49
|
+
|
50
|
+
# Changing publish_at via `update` causes the release to publish due to Sidekiq inline
|
51
|
+
previous_publish_at = b.publish_at
|
52
|
+
b.set(publish_at: nil)
|
53
|
+
|
54
|
+
Sidekiq::Callbacks.enable(IndexProduct) do
|
55
|
+
IndexReleaseScheduleChange.new.perform(b.id, previous_publish_at, nil)
|
56
|
+
end
|
57
|
+
|
58
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
59
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
60
|
+
c.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_adding_to_schedule
|
64
|
+
a = create_release(name: 'A', publish_at: 1.week.from_now)
|
65
|
+
b = create_release(name: 'B')
|
66
|
+
c = create_release(name: 'C', publish_at: 4.weeks.from_now)
|
67
|
+
|
68
|
+
b.as_current { @product.update!(name: 'Bar') }
|
69
|
+
IndexProduct.perform(@product)
|
70
|
+
|
71
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
72
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
73
|
+
c.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
74
|
+
|
75
|
+
# Changing publish_at via `update` causes the release to publish due to Sidekiq inline
|
76
|
+
b.set(publish_at: 2.weeks.from_now)
|
77
|
+
|
78
|
+
Sidekiq::Callbacks.enable(IndexProduct) do
|
79
|
+
IndexReleaseScheduleChange.new.perform(b.id, nil, b.publish_at)
|
80
|
+
end
|
81
|
+
|
82
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
83
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
84
|
+
c.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_destroyed
|
88
|
+
a = create_release(name: 'A', publish_at: 1.week.from_now)
|
89
|
+
b = create_release(name: 'B', publish_at: 2.weeks.from_now)
|
90
|
+
c = create_release(name: 'C', publish_at: 4.weeks.from_now)
|
91
|
+
|
92
|
+
b.as_current { @product.update!(name: 'Bar') }
|
93
|
+
IndexProduct.perform(@product)
|
94
|
+
|
95
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
96
|
+
b.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
97
|
+
c.as_current { assert_equal([@product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
98
|
+
|
99
|
+
Sidekiq::Callbacks.enable(IndexReleaseScheduleChange, IndexProduct) do
|
100
|
+
b.destroy
|
101
|
+
end
|
102
|
+
|
103
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
104
|
+
c.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -2,6 +2,8 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Workarea
|
4
4
|
class PublishReleaseTest < TestCase
|
5
|
+
include TestCase::SearchIndexing
|
6
|
+
|
5
7
|
def test_publishes_the_release
|
6
8
|
release = create_release
|
7
9
|
PublishRelease.new.perform(release.id)
|
@@ -16,5 +18,27 @@ module Workarea
|
|
16
18
|
assert_equal(1, Mongoid::AuditLog::Entry.count)
|
17
19
|
assert(Mongoid::AuditLog::Entry.first.modifier.system?)
|
18
20
|
end
|
21
|
+
|
22
|
+
def test_reindexes_release_schedule
|
23
|
+
product = create_product(name: 'Foo')
|
24
|
+
|
25
|
+
a = create_release(publish_at: 1.week.from_now)
|
26
|
+
b = create_release(publish_at: 2.weeks.from_now)
|
27
|
+
c = create_release(publish_at: 4.weeks.from_now)
|
28
|
+
|
29
|
+
b.as_current { product.update!(name: 'Bar') }
|
30
|
+
IndexProduct.perform(product)
|
31
|
+
|
32
|
+
assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model))
|
33
|
+
a.as_current { assert_empty(Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
34
|
+
b.as_current { assert_equal([product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
35
|
+
c.as_current { assert_equal([product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
36
|
+
|
37
|
+
Sidekiq::Callbacks.enable(IndexProduct) { PublishRelease.new.perform(b.id) }
|
38
|
+
|
39
|
+
assert_equal([product], Search::ProductSearch.new(q: 'bar').results.pluck(:model))
|
40
|
+
a.as_current { assert_equal([product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
41
|
+
c.as_current { assert_equal([product], Search::ProductSearch.new(q: 'bar').results.pluck(:model)) }
|
42
|
+
end
|
19
43
|
end
|
20
44
|
end
|
data/workarea-core.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency 'mongoid-sample', '~> 0.1.0'
|
26
26
|
s.add_dependency 'mongoid-encrypted', '~> 1.0.0'
|
27
27
|
s.add_dependency 'elasticsearch', '~> 5.0.1'
|
28
|
-
s.add_dependency 'kaminari', '~>
|
28
|
+
s.add_dependency 'kaminari', '~> 1.2.1'
|
29
29
|
s.add_dependency 'kaminari-mongoid', '~> 0.1.2'
|
30
30
|
s.add_dependency 'activemerchant', '~> 1.52'
|
31
31
|
s.add_dependency 'dragonfly', '~> 1.1.2'
|
@@ -33,7 +33,8 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_dependency 'sidekiq-cron', '~> 0.6.3'
|
34
34
|
s.add_dependency 'sidekiq-unique-jobs', '~> 6.0.6'
|
35
35
|
s.add_dependency 'sidekiq-throttled', '~> 0.8.2'
|
36
|
-
s.add_dependency 'geocoder', '~> 1.
|
36
|
+
s.add_dependency 'geocoder', '~> 1.6.3'
|
37
|
+
s.add_dependency 'redis-rails', '~> 5.0.0'
|
37
38
|
s.add_dependency 'redis-rack-cache', '~> 2.2.0'
|
38
39
|
s.add_dependency 'easymon', '~> 1.4.0'
|
39
40
|
s.add_dependency 'image_optim', '~> 0.26.0'
|
@@ -65,7 +66,7 @@ Gem::Specification.new do |s|
|
|
65
66
|
s.add_dependency 'chart-horizontalbar-rails', '~> 1.0.4' # TODO remove v4
|
66
67
|
s.add_dependency 'select2-rails', '~> 4.0.3'
|
67
68
|
s.add_dependency 'wysihtml-rails', '~> 0.6.0.beta2'
|
68
|
-
s.add_dependency 'rack-attack', '~>
|
69
|
+
s.add_dependency 'rack-attack', '~> 6.3.1'
|
69
70
|
s.add_dependency 'jquery-livetype-rails', '~> 0.1.0' # TODO remove v4
|
70
71
|
s.add_dependency 'redcarpet', '~> 3.4.0'
|
71
72
|
s.add_dependency 'jquery-unique-clone-rails', '~> 1.0.0'
|
@@ -90,10 +91,10 @@ Gem::Specification.new do |s|
|
|
90
91
|
s.add_dependency 'loofah', '~> 2.3.1'
|
91
92
|
s.add_dependency 'referer-parser', '~> 0.3.0'
|
92
93
|
s.add_dependency 'serviceworker-rails', '~> 0.5.5'
|
93
|
-
s.add_dependency 'chartkick', '~> 3.
|
94
|
+
s.add_dependency 'chartkick', '~> 3.4.0'
|
94
95
|
s.add_dependency 'browser', '~> 2.6.1'
|
95
96
|
s.add_dependency 'puma', '>= 4.3.1'
|
96
|
-
s.add_dependency 'rack', '>= 2.
|
97
|
+
s.add_dependency 'rack' , '>= 2.1.4'
|
97
98
|
|
98
99
|
# HACK for vendoring active_shipping
|
99
100
|
s.add_dependency 'active_utils', '~> 3.3.1'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.17
|
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
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 1.2.1
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 1.2.1
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: kaminari-mongoid
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,14 +282,28 @@ dependencies:
|
|
282
282
|
requirements:
|
283
283
|
- - "~>"
|
284
284
|
- !ruby/object:Gem::Version
|
285
|
-
version: 1.
|
285
|
+
version: 1.6.3
|
286
286
|
type: :runtime
|
287
287
|
prerelease: false
|
288
288
|
version_requirements: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
290
|
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: 1.
|
292
|
+
version: 1.6.3
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: redis-rails
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - "~>"
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: 5.0.0
|
300
|
+
type: :runtime
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - "~>"
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: 5.0.0
|
293
307
|
- !ruby/object:Gem::Dependency
|
294
308
|
name: redis-rack-cache
|
295
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -730,14 +744,14 @@ dependencies:
|
|
730
744
|
requirements:
|
731
745
|
- - "~>"
|
732
746
|
- !ruby/object:Gem::Version
|
733
|
-
version:
|
747
|
+
version: 6.3.1
|
734
748
|
type: :runtime
|
735
749
|
prerelease: false
|
736
750
|
version_requirements: !ruby/object:Gem::Requirement
|
737
751
|
requirements:
|
738
752
|
- - "~>"
|
739
753
|
- !ruby/object:Gem::Version
|
740
|
-
version:
|
754
|
+
version: 6.3.1
|
741
755
|
- !ruby/object:Gem::Dependency
|
742
756
|
name: jquery-livetype-rails
|
743
757
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1086,14 +1100,14 @@ dependencies:
|
|
1086
1100
|
requirements:
|
1087
1101
|
- - "~>"
|
1088
1102
|
- !ruby/object:Gem::Version
|
1089
|
-
version: 3.
|
1103
|
+
version: 3.4.0
|
1090
1104
|
type: :runtime
|
1091
1105
|
prerelease: false
|
1092
1106
|
version_requirements: !ruby/object:Gem::Requirement
|
1093
1107
|
requirements:
|
1094
1108
|
- - "~>"
|
1095
1109
|
- !ruby/object:Gem::Version
|
1096
|
-
version: 3.
|
1110
|
+
version: 3.4.0
|
1097
1111
|
- !ruby/object:Gem::Dependency
|
1098
1112
|
name: browser
|
1099
1113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1128,14 +1142,14 @@ dependencies:
|
|
1128
1142
|
requirements:
|
1129
1143
|
- - ">="
|
1130
1144
|
- !ruby/object:Gem::Version
|
1131
|
-
version: 2.
|
1145
|
+
version: 2.1.4
|
1132
1146
|
type: :runtime
|
1133
1147
|
prerelease: false
|
1134
1148
|
version_requirements: !ruby/object:Gem::Requirement
|
1135
1149
|
requirements:
|
1136
1150
|
- - ">="
|
1137
1151
|
- !ruby/object:Gem::Version
|
1138
|
-
version: 2.
|
1152
|
+
version: 2.1.4
|
1139
1153
|
- !ruby/object:Gem::Dependency
|
1140
1154
|
name: active_utils
|
1141
1155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1720,6 +1734,7 @@ files:
|
|
1720
1734
|
- app/services/workarea/direct_upload/product_image.rb
|
1721
1735
|
- app/services/workarea/export_report.rb
|
1722
1736
|
- app/services/workarea/hash_update.rb
|
1737
|
+
- app/services/workarea/index_release_schedule_previews.rb
|
1723
1738
|
- app/services/workarea/inventory_adjustment.rb
|
1724
1739
|
- app/services/workarea/login.rb
|
1725
1740
|
- app/services/workarea/new_discount.rb
|
@@ -1757,6 +1772,7 @@ files:
|
|
1757
1772
|
- app/workers/workarea/index_product.rb
|
1758
1773
|
- app/workers/workarea/index_product_children.rb
|
1759
1774
|
- app/workers/workarea/index_product_rule.rb
|
1775
|
+
- app/workers/workarea/index_release_schedule_change.rb
|
1760
1776
|
- app/workers/workarea/index_search_customizations.rb
|
1761
1777
|
- app/workers/workarea/index_skus.rb
|
1762
1778
|
- app/workers/workarea/keep_product_index_fresh.rb
|
@@ -1930,6 +1946,7 @@ files:
|
|
1930
1946
|
- lib/workarea/ext/freedom_patches/string.rb
|
1931
1947
|
- lib/workarea/ext/freedom_patches/uri.rb
|
1932
1948
|
- lib/workarea/ext/jbuilder/jbuilder_append_partials.rb
|
1949
|
+
- lib/workarea/ext/jbuilder/jbuilder_cache.rb
|
1933
1950
|
- lib/workarea/ext/mongoid/audit_log_entry.decorator
|
1934
1951
|
- lib/workarea/ext/mongoid/each_by.rb
|
1935
1952
|
- lib/workarea/ext/mongoid/embedded_children.rb
|
@@ -1964,6 +1981,7 @@ files:
|
|
1964
1981
|
- lib/workarea/ping_home_base.rb
|
1965
1982
|
- lib/workarea/plugin.rb
|
1966
1983
|
- lib/workarea/plugin/asset_appends_helper.rb
|
1984
|
+
- lib/workarea/queues_pauser.rb
|
1967
1985
|
- lib/workarea/routes_constraints/redirect.rb
|
1968
1986
|
- lib/workarea/routes_constraints/super_admin.rb
|
1969
1987
|
- lib/workarea/scheduled_jobs.rb
|
@@ -2314,6 +2332,7 @@ files:
|
|
2314
2332
|
- test/models/workarea/search/storefront/product/inventory_test.rb
|
2315
2333
|
- test/models/workarea/search/storefront/product/pricing_test.rb
|
2316
2334
|
- test/models/workarea/search/storefront/product/text_test.rb
|
2335
|
+
- test/models/workarea/search/storefront/product_releases_test.rb
|
2317
2336
|
- test/models/workarea/search/storefront/product_test.rb
|
2318
2337
|
- test/models/workarea/search/storefront_test.rb
|
2319
2338
|
- test/models/workarea/segment/life_cycle_test.rb
|
@@ -2365,7 +2384,6 @@ files:
|
|
2365
2384
|
- test/queries/workarea/pricing_override_params_test.rb
|
2366
2385
|
- test/queries/workarea/product_primary_image_url_test.rb
|
2367
2386
|
- test/queries/workarea/product_primary_navigation_test.rb
|
2368
|
-
- test/queries/workarea/product_releases_test.rb
|
2369
2387
|
- test/queries/workarea/recommendation/order_based_test.rb
|
2370
2388
|
- test/queries/workarea/recommendation/product_based_test.rb
|
2371
2389
|
- test/queries/workarea/recommendation/searches_test.rb
|
@@ -2426,6 +2444,7 @@ files:
|
|
2426
2444
|
- test/services/workarea/direct_upload_test.rb
|
2427
2445
|
- test/services/workarea/export_report_test.rb
|
2428
2446
|
- test/services/workarea/hash_update_test.rb
|
2447
|
+
- test/services/workarea/index_release_schedule_previews_test.rb
|
2429
2448
|
- test/services/workarea/inventory_adjustment_test.rb
|
2430
2449
|
- test/services/workarea/login_test.rb
|
2431
2450
|
- test/services/workarea/order_merge_test.rb
|
@@ -2458,6 +2477,7 @@ files:
|
|
2458
2477
|
- test/workers/workarea/index_payment_transactions_test.rb
|
2459
2478
|
- test/workers/workarea/index_product_rule_test.rb
|
2460
2479
|
- test/workers/workarea/index_product_test.rb
|
2480
|
+
- test/workers/workarea/index_release_schedule_change_test.rb
|
2461
2481
|
- test/workers/workarea/index_skus_test.rb
|
2462
2482
|
- test/workers/workarea/keep_product_index_fresh_test.rb
|
2463
2483
|
- test/workers/workarea/mark_discounts_as_redeemed_test.rb
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Workarea
|
4
|
-
class ProductReleasesTest < TestCase
|
5
|
-
def test_product_changes
|
6
|
-
product = create_product(name: 'Foo')
|
7
|
-
release_one = create_release
|
8
|
-
release_one.as_current { product.update!(name: 'Bar') }
|
9
|
-
|
10
|
-
assert_equal([release_one], ProductReleases.new(product).releases)
|
11
|
-
|
12
|
-
release_one.update!(publish_at: 1.day.from_now)
|
13
|
-
release_two = create_release(publish_at: 3.days.from_now)
|
14
|
-
assert_equal([release_one, release_two], ProductReleases.new(product).releases)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_featured_product_changes
|
18
|
-
product = create_product
|
19
|
-
category = create_category
|
20
|
-
|
21
|
-
release_one = create_release
|
22
|
-
release_one.as_current { category.update!(product_ids: [product.id]) }
|
23
|
-
assert_equal([release_one], ProductReleases.new(product).releases)
|
24
|
-
|
25
|
-
release_one.update!(publish_at: 1.day.from_now)
|
26
|
-
release_two = create_release(publish_at: 3.days.from_now)
|
27
|
-
assert_equal([release_one, release_two], ProductReleases.new(product).releases)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_variant_changes
|
31
|
-
product = create_product(variants: [{ sku: 'SKU' }])
|
32
|
-
release = create_release
|
33
|
-
release.as_current { product.variants.first.update!(details: { color: 'Red' }) }
|
34
|
-
assert_equal([release], ProductReleases.new(product).releases)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_pricing_changes
|
38
|
-
product = create_product(variants: [{ sku: 'SKU' }])
|
39
|
-
pricing = Pricing::Sku.find('SKU')
|
40
|
-
|
41
|
-
release = create_release
|
42
|
-
release.as_current { pricing.prices.first.update!(regular: 10_000) }
|
43
|
-
assert_equal([release], ProductReleases.new(product).releases)
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_changesets_with_missing_releases
|
47
|
-
product = create_product(name: 'Foo')
|
48
|
-
release = create_release
|
49
|
-
release.as_current { product.update!(name: 'Bar') }
|
50
|
-
release.delete
|
51
|
-
|
52
|
-
assert_nil(product.reload.changesets.first.release)
|
53
|
-
assert_equal([], ProductReleases.new(product).releases)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|