elasticsearch-api 8.5.0 → 8.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/api-spec-testing/rspec_matchers.rb +26 -4
- data/api-spec-testing/test_file/action.rb +6 -0
- data/lib/elasticsearch/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bd26909280a3cbc03ad35a729262ee7c0cf4e274ace5ccc754c334bbb667a9b
|
4
|
+
data.tar.gz: 5bb02f69dafac974d267266fe6025c0ab83ace5953902a54f2f2e4497cb12b2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2e7567c87875abd3d703c240eece417186d177525efdece09cf7ed870d53c7f3e84e2a4faebc116d0f2176ce91cf3be43c1c3a7790f607b7fcd56e5f8fe3400
|
7
|
+
data.tar.gz: 203af27e5d281b2a72330c17179187b874a87a364484757ed6128aae5b3a80a5b18be06841f0bc3631ab4e17399b39b255b4d2b40989b380c2df231072d40f8a
|
@@ -42,6 +42,14 @@ end
|
|
42
42
|
# Validate that a field is `true`.
|
43
43
|
RSpec::Matchers.define :match_true_field do |field, test|
|
44
44
|
match do |response|
|
45
|
+
# TODO: Refactor! split_key for is_true
|
46
|
+
if (match = field.match(/(^\$[a-z]+)/))
|
47
|
+
keys = field.split('.')
|
48
|
+
keys.delete(match[1])
|
49
|
+
dynamic_key = test.cached_values[match[1].gsub('$', '')]
|
50
|
+
return !!dynamic_key.dig(*keys)
|
51
|
+
end
|
52
|
+
|
45
53
|
# Handle is_true: ''
|
46
54
|
return !!response if field == ''
|
47
55
|
|
@@ -190,10 +198,24 @@ RSpec::Matchers.define :match_response do |pairs, test|
|
|
190
198
|
|
191
199
|
def compare_hash(expected_pairs, actual_hash, test)
|
192
200
|
expected_pairs.each do |expected_key, expected_value|
|
193
|
-
#
|
194
|
-
|
195
|
-
|
196
|
-
|
201
|
+
# TODO: Refactor! split_key
|
202
|
+
if (match = expected_key.match(/(^\$[a-z]+)/))
|
203
|
+
keys = expected_key.split('.')
|
204
|
+
keys.delete(match[1])
|
205
|
+
dynamic_key = test.cached_values[match[1].gsub('$', '')]
|
206
|
+
value = dynamic_key.dig(*keys)
|
207
|
+
|
208
|
+
if expected_pairs.values.first.is_a?(String) && expected_pairs.values.first.match?(/^\$/)
|
209
|
+
return test.cached_values[expected_pairs.values.first.gsub('$','')] == value
|
210
|
+
else
|
211
|
+
return expected_pairs.values.first == value
|
212
|
+
end
|
213
|
+
|
214
|
+
else
|
215
|
+
split_key = TestFile::Test.split_and_parse_key(expected_key).collect do |k|
|
216
|
+
# Sometimes the expected *key* is a cached value from a previous request.
|
217
|
+
test.get_cached_value(k)
|
218
|
+
end
|
197
219
|
end
|
198
220
|
# We now accept 'nested.keys' so let's try the previous implementation and if that doesn't
|
199
221
|
# work, try with the nested key, otherwise, raise exception.
|
@@ -122,6 +122,12 @@ module Elasticsearch
|
|
122
122
|
@response = client.send(_method, prepare_arguments(args, test))
|
123
123
|
end
|
124
124
|
client
|
125
|
+
when 'update_user_profile_data', 'get_user_profile', 'enable_user_profile', 'disable_user_profile'
|
126
|
+
args.each do |key, value|
|
127
|
+
args[key] = value.gsub(value, test.cached_values[value.gsub('$', '')]) if value.match?(/^\$/)
|
128
|
+
end
|
129
|
+
@response = client.send(_method, prepare_arguments(args, test))
|
130
|
+
client
|
125
131
|
else
|
126
132
|
@response = client.send(_method, prepare_arguments(args, test))
|
127
133
|
client
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.5.
|
4
|
+
version: 8.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|