Skip to content

Commit 92d6c7d

Browse files
committed
[Test Runner] Whitespace and minor refactors
1 parent 7355225 commit 92d6c7d

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

spec/yaml-test-runner/code_runner.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def do_action(action)
4343
client = CLIENT.send(arrayed_method.first)
4444
method = arrayed_method.last
4545
end
46-
4746
@response = client.send(
4847
method.to_sym,
4948
process_params(params)
@@ -126,7 +125,7 @@ def compare(action)
126125
operator, value = action.first
127126

128127
result = search_in_response(value.keys.first)
129-
if result && result.send(COMPARATORS[operator], value[value.keys.first])
128+
if result&.send(COMPARATORS[operator], value[value.keys.first])
130129
print_success
131130
else
132131
print_failure(action, @response)

spec/yaml-test-runner/runner.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,14 @@
3737
else
3838
Dir.glob("#{PATH}/**/*.yml")
3939
end
40-
4140
test_files.map do |test_file|
4241
next if SKIPPED_TESTS.include?(test_file.split('/').last(2).join('/'))
4342

4443
yaml = YAML.load_stream(File.read(test_file))
45-
4644
# Create the test object:
4745
requires = yaml.map.with_index { |a, i| yaml.delete_at(i) if a.keys.first == 'requires' }.compact
4846
setup = yaml.map.with_index { |a, i| yaml.delete_at(i) if a.keys.first == 'setup' }.compact.first&.[]('setup')
4947
teardown = yaml.map.with_index { |a, i| yaml.delete_at(i) if a.keys.first == 'teardown' }.compact.first
50-
5148
yaml.each do |test_data|
5249
title, actions = test_data.first
5350
test = Elastic::TestRunner::Test.new(title, test_file, setup, actions, teardown)

spec/yaml-test-runner/test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def run_action(action)
7171
def run_setup
7272
return unless @setup
7373

74-
@setup.map { |step| do_action(step['do']) }
74+
@setup.map do |step|
75+
do_action(step['do']) if step['do']
76+
end
7577
end
7678

7779
def run_teardown

0 commit comments

Comments
 (0)