class HammerCLI::Testing::OutputMatchers::IndexLineMatcher
Public Class Methods
new(expected=[])
click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 75 def initialize(expected=[]) @expected_values = expected end
Public Instance Methods
assert_match(actual)
click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 79 def assert_match(actual) message = [ "Regex didn't match the output.", "Expected regex:", line_regexp.source, "Expected fields:", @expected_values.join(' | '), "Actual output:", actual ].join("\n") assert(line_regexp =~ actual, message) end
Protected Instance Methods
line_regexp()
click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 95 def line_regexp re = @expected_values.map do |column| Regexp.quote(column) end.join('[ ]*\|[ ]*') Regexp.new("[ ]*#{re}[ ]*") end