module TestBench::Output::Assertions
Public Instance Methods
color_output?()
click to toggle source
# File lib/test_bench/output/assertions.rb, line 4 def color_output? text = 'Some Text' color = :gray write text, :fg => color, :bg => color wrote_line? text, :fg => color, :bg => color end
text_written()
click to toggle source
# File lib/test_bench/output/assertions.rb, line 13 def text_written device.rewind device.read end
wrote?(text)
click to toggle source
# File lib/test_bench/output/assertions.rb, line 18 def wrote? text text_written == text end
wrote_line?(text, indent: nil, **colors)
click to toggle source
# File lib/test_bench/output/assertions.rb, line 22 def wrote_line? text, indent: nil, **colors color ||= {} indent ||= 0 color_escape = Palette.escape_code(**colors) unless color_escape.empty? text = "#{color_escape}#{text}\e[0m" end matcher = Regexp.escape "#{' ' * indent}#{text}" pattern = /^#{matcher}$/n pattern.match text_written end
wrote_nothing?()
click to toggle source
# File lib/test_bench/output/assertions.rb, line 38 def wrote_nothing? text_written.empty? end