Skip to content

Commit 3f9d2fa

Browse files
committed
Fixed tests moving array of one boolean value to use a single boolean value
1 parent 17eacb9 commit 3f9d2fa

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Diff for: spec/helpers/spec_helper.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ def initialize
3131

3232
def trace_for(symbol)
3333
params = @tracer.map {|k,v| k == symbol ? v : nil}.compact
34-
params.empty? ? false : params
34+
if params.empty?
35+
false
36+
else
37+
# merge all params with same key
38+
# there could be multiple instances of same call, e.g. [[:accept, true], [:auto_flush, true], [:close, true], [:auto_flush, true]]
39+
params.reduce {|b1, b2| b1 and b2}
40+
end
3541
end
3642

3743
def clear

Diff for: spec/inputs/file_tail_spec.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
.then("wait accept") do
333333
wait(0.75).for {
334334
subject.codec.identity_map[tmpfile_path].codec.trace_for(:accept)
335-
}.to eq([true]), "accept didn't"
335+
}.to eq(true), "accept didn't"
336336
end
337337
.then("request a stop") do
338338
# without this the subject.run doesn't invokes the #exit_flush which is the only @codec.flush_mapped invocation
@@ -341,12 +341,11 @@
341341
.then("wait for auto_flush") do
342342
wait(2).for {
343343
subject.codec.identity_map[tmpfile_path].codec.trace_for(:auto_flush)
344-
.reduce {|b1, b2| b1 and b2} # there could be multiple instances of same call, e.g. [[:accept, true], [:auto_flush, true], [:close, true], [:auto_flush, true]]
345344
}.to eq(true), "autoflush didn't"
346345
end
347346
subject.run(events)
348347
actions.assert_no_errors
349-
expect(subject.codec.identity_map[tmpfile_path].codec.trace_for(:accept)).to eq([true])
348+
expect(subject.codec.identity_map[tmpfile_path].codec.trace_for(:accept)).to eq(true)
350349
end
351350
end
352351

0 commit comments

Comments
 (0)