workarea-core 3.4.14 → 3.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/queries/workarea/search/storefront_search/exact_matches.rb +1 -1
- data/app/seeds/workarea/admins_seeds.rb +1 -1
- data/lib/workarea/swappable_list.rb +4 -0
- data/lib/workarea/version.rb +1 -1
- data/test/lib/workarea/swappable_list_test.rb +11 -0
- data/test/queries/workarea/search/storefront_search_test.rb +15 -0
- metadata +2 -3
- data/lib/minitest/workarea_plugin.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca7289a6b90924018068c1ab8f800600ed3c714d63a08cf95217224efc8f069c
|
4
|
+
data.tar.gz: 23a4f30485bb3d230669213d5f7acd258a605865ea0f1a94da9ce4321d941224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac75f323f12f1e4ebfdf965edc82524219daa425fcf3fe90999e2ffc173ff18ec987616df95527328f0d568a7471fe570053ce1c73c511c3bce08202a076c8ad
|
7
|
+
data.tar.gz: f4dd55dd0a19e1d3db07e6e181c5a349ec19ee40b5c91026b1286bb09419ecb2d9c4e80d9169d0975cef1f5efc22d38f81db358d2f6cd15df5820baeb2ccfa49
|
@@ -7,7 +7,7 @@ module Workarea
|
|
7
7
|
def call(response)
|
8
8
|
exact_match = find_exact_match(response)
|
9
9
|
|
10
|
-
if !response.has_filters? && exact_match.present?
|
10
|
+
if response.customization.new_record? && !response.has_filters? && exact_match.present?
|
11
11
|
response.redirect = product_path(exact_match)
|
12
12
|
else
|
13
13
|
yield
|
data/lib/workarea/version.rb
CHANGED
@@ -41,5 +41,16 @@ module Workarea
|
|
41
41
|
assert_instance_of(SwappableList, @list)
|
42
42
|
refute_includes(@list, :three)
|
43
43
|
end
|
44
|
+
|
45
|
+
def test_deep_dup
|
46
|
+
config_1 = ActiveSupport::OrderedOptions.new
|
47
|
+
config_1.list = SwappableList.new([:foo])
|
48
|
+
config_2 = config_1.deep_dup
|
49
|
+
|
50
|
+
config_2.list.swap(:foo, :bar)
|
51
|
+
|
52
|
+
assert_equal([:foo], config_1.list.to_a)
|
53
|
+
assert_equal([:bar], config_2.list.to_a)
|
54
|
+
end
|
44
55
|
end
|
45
56
|
end
|
@@ -106,6 +106,21 @@ module Workarea
|
|
106
106
|
assert_kind_of(StorefrontSearch::ProductMultipass, trace.third.reset_by)
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
def test_exact_match_customization
|
111
|
+
IndexProduct.perform(create_product(id: '1', name: 'Foo'))
|
112
|
+
IndexProduct.perform(create_product(id: '2', name: 'Bar'))
|
113
|
+
IndexProduct.perform(create_product(id: '3', name: 'Baz'))
|
114
|
+
create_search_customization(
|
115
|
+
id: 'foo', query: 'foo', product_ids: %w(2 3)
|
116
|
+
)
|
117
|
+
|
118
|
+
search = StorefrontSearch.new(q: 'foo')
|
119
|
+
|
120
|
+
refute_nil(search.response.customization)
|
121
|
+
assert_nil(search.response.redirect)
|
122
|
+
refute_kind_of(StorefrontSearch::ExactMatches, search.used_middleware.last)
|
123
|
+
end
|
109
124
|
end
|
110
125
|
end
|
111
126
|
end
|
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.4.
|
4
|
+
version: 3.4.15
|
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
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -1772,7 +1772,6 @@ files:
|
|
1772
1772
|
- lib/generators/workarea/style_guide/USAGE
|
1773
1773
|
- lib/generators/workarea/style_guide/style_guide_generator.rb
|
1774
1774
|
- lib/generators/workarea/style_guide/templates/style_guide_partial.html.haml.erb
|
1775
|
-
- lib/minitest/workarea_plugin.rb
|
1776
1775
|
- lib/tasks/assets.rake
|
1777
1776
|
- lib/tasks/cache.rake
|
1778
1777
|
- lib/tasks/cleanup.rake
|