class BlueShell::Matchers::OutputMatcher
Public Class Methods
new(expected_output)
click to toggle source
# File lib/blue-shell/matchers/output_matcher.rb, line 4 def initialize(expected_output) @expected_output = expected_output end
Public Instance Methods
failure_message()
click to toggle source
# File lib/blue-shell/matchers/output_matcher.rb, line 15 def failure_message if @expected_output.is_a?(Hash) expected_keys = @expected_output.keys.map{|key| "'#{key}'"}.join(', ') "expected one of #{expected_keys} to be printed, but it wasn't. full output:\n#@full_output" else "expected '#{@expected_output}' to be printed, but it wasn't. full output:\n#@full_output" end end
matches?(runner)
click to toggle source
# File lib/blue-shell/matchers/output_matcher.rb, line 8 def matches?(runner) raise Errors::InvalidInputError unless runner.respond_to?(:expect) @matched = runner.expect(@expected_output) @full_output = runner.output !!@matched end
negative_failure_message()
click to toggle source
# File lib/blue-shell/matchers/output_matcher.rb, line 24 def negative_failure_message if @expected_output.is_a?(Hash) match = @matched else match = @expected_output end "expected '#{match}' to not be printed, but it was. full output:\n#@full_output" end