Skip to content

Commit

Permalink
use assert_block to output clearer fail logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ono-max committed Jun 13, 2021
1 parent d1de53b commit 7ce5a0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/support/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ def assert_block(message)

def assert_line_num(expected)
@queue.push(Proc.new {
assert_equal(expected, @internal_info['line'], create_message("Expected line number to be #{expected}, but was #{@internal_info['line']}"))
assert_block("Expected line number to be #{expected}, but was #{@internal_info['line']}") { expected == @internal_info['line'] }
})
end

def assert_line_text(expected)
@queue.push(Proc.new {
assert_match(expected, @last_backlog[2..].join, create_message("Expected to include #{expected}"))
result = @last_backlog[2..].join
assert_block("Expected to include `#{expected}` in\n(\n#{result})\n") { result.match? expected }
})
end

Expand Down

0 comments on commit 7ce5a0d

Please sign in to comment.