We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb83f53 commit 95e7573Copy full SHA for 95e7573
elasticsearch-api/api-spec-testing/rspec_matchers.rb
@@ -42,6 +42,14 @@
42
# Validate that a field is `true`.
43
RSpec::Matchers.define :match_true_field do |field, test|
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
+
53
# Handle is_true: ''
54
return !!response if field == ''
55
0 commit comments