class HammerCLI::Testing::OutputMatchers::FieldMatcher

Public Class Methods

matcher(label, value) click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 26
def self.matcher(label, value)
  Regexp.new(Regexp.quote(label) + ':[ ]+' + Regexp.quote(value))
end
new(label, value) click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 17
def initialize(label, value)
  @expected = FieldMatcher.matcher(label, value)
end

Public Instance Methods

assert_match(test_ctx, actual) click to toggle source
# File lib/hammer_cli/testing/output_matchers.rb, line 21
def assert_match(test_ctx, actual)
  message = "Regex /#{@expected.source}/ didn't match the output:\n#{actual}"
  test_ctx.assert(@expected =~ actual, message)
end