Skip to content

Commit ef4e705

Browse files
committed
[API] YAML runner minimal cleanup
1 parent 5b2d7b6 commit ef4e705

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

elasticsearch-api/spec/elasticsearch/api/rest_api_yaml_spec.rb

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,23 @@
66
require 'rest_yaml_tests_helper'
77

88
describe 'Rest API YAML tests' do
9-
9+
# Traverse YAML files and create TestFile object:
1010
REST_API_YAML_FILES.each do |file|
11-
1211
test_file = Elasticsearch::RestAPIYAMLTests::TestFile.new(file, REST_API_YAML_SKIP_FEATURES)
1312

1413
context "#{file.gsub("#{YAML_FILES_DIRECTORY}/", '')}" do
15-
1614
test_file.tests.each do |test|
1715

1816
context "#{test.description}" do
19-
2017
if test.skip_test?(ADMIN_CLIENT)
2118
skip 'Test contains feature(s) not yet supported or version is not satisfied'
22-
2319
else
24-
2520
let(:client) do
2621
DEFAULT_CLIENT
2722
end
2823

2924
# Runs once before each test in a test file
3025
before(:all) do
31-
# Runs once before each test in a test file
3226
Elasticsearch::RestAPIYAMLTests::TestFile.clear_data(ADMIN_CLIENT)
3327
test_file.setup(ADMIN_CLIENT)
3428
end
@@ -39,21 +33,18 @@
3933
end
4034

4135
test.task_groups.each do |task_group|
42-
4336
before do
4437
task_group.run(client)
4538
end
4639

4740
# 'catch' is in the task group definition
4841
if task_group.catch_exception?
49-
5042
it 'sends the request and throws the expected error' do
5143
expect(task_group.exception).to match_error(task_group.expected_exception_message)
5244
end
5345

5446
# 'match' on error description is in the task group definition
5547
if task_group.has_match_clauses?
56-
5748
task_group.match_clauses.each do |match|
5849
it 'contains the expected error in the request response' do
5950
expect(task_group.exception.message).to match(Regexp.new(Regexp.escape(match['match'].values.first.to_s)))
@@ -64,7 +55,6 @@
6455

6556
# 'match' is in the task group definition
6657
if task_group.has_match_clauses?
67-
6858
task_group.match_clauses.each do |match|
6959
it "has the expected value (#{match['match'].values.join(',')}) in the response field (#{match['match'].keys.join(',')})" do
7060
expect(task_group.response).to match_response(match['match'], test)
@@ -74,7 +64,6 @@
7464

7565
# 'length' is in the task group definition
7666
if task_group.has_length_match_clauses?
77-
7867
task_group.length_match_clauses.each do |match|
7968
it "the '#{match['length'].keys.join(',')}' field have the expected length" do
8069
expect(task_group.response).to match_response_field_length(match['length'], test)
@@ -84,7 +73,6 @@
8473

8574
# 'is_true' is in the task group definition
8675
if task_group.has_true_clauses?
87-
8876
task_group.true_clauses.each do |match|
8977
it "sends the request and the '#{match['is_true']}' field is set to true" do
9078
expect(task_group.response).to match_true_field(match['is_true'], test)
@@ -94,7 +82,6 @@
9482

9583
# 'is_false' is in the task group definition
9684
if task_group.has_false_clauses?
97-
9885
task_group.false_clauses.each do |match|
9986
it "sends the request and the '#{match['is_false']}' field is set to true" do
10087
expect(task_group.response).to match_false_field(match['is_false'], test)
@@ -104,7 +91,6 @@
10491

10592
# 'gte' is in the task group definition
10693
if task_group.has_gte_clauses?
107-
10894
task_group.gte_clauses.each do |match|
10995
it "sends the request and the '#{match['gte']}' field is greater than or equal to the expected value" do
11096
expect(task_group.response).to match_gte_field(match['gte'], test)
@@ -114,7 +100,6 @@
114100

115101
# 'gt' is in the task group definition
116102
if task_group.has_gt_clauses?
117-
118103
task_group.gt_clauses.each do |match|
119104
it "sends the request and the '#{match['gt']}' field is greater than the expected value" do
120105
expect(task_group.response).to match_gt_field(match['gt'], test)
@@ -124,7 +109,6 @@
124109

125110
# 'lte' is in the task group definition
126111
if task_group.has_lte_clauses?
127-
128112
task_group.lte_clauses.each do |match|
129113
it "sends the request and the '#{match['lte']}' field is less than or equal to the expected value" do
130114
expect(task_group.response).to match_lte_field(match['lte'], test)
@@ -134,7 +118,6 @@
134118

135119
# 'lt' is in the task group definition
136120
if task_group.has_lt_clauses?
137-
138121
task_group.lt_clauses.each do |match|
139122
it "sends the request and the '#{match['lt']}' field is less than the expected value" do
140123
expect(task_group.response).to match_lt_field(match['lt'], test)

0 commit comments

Comments
 (0)