class TestBench::Output::Writer::Assertions::Line
Constants
- IgnoreParameter
- Pattern
Attributes
match[R]
Public Class Methods
new(match)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 10 def initialize match @match = match end
parse(line)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 14 def self.parse line match = Pattern.match line new match end
Public Instance Methods
background_color?(bg)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 30 def background_color? bg if bg.nil? match['bg'].nil? else _, code = Palette.get bg match['bg'].to_i == code + 40 end end
call(expected_prose, bg: IgnoreParameter, fg: IgnoreParameter, indentation: IgnoreParameter)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 19 def call expected_prose, bg: IgnoreParameter, fg: IgnoreParameter, indentation: IgnoreParameter return unless match return unless prose? expected_prose return unless foreground_color? fg unless fg == IgnoreParameter return unless background_color? bg unless bg == IgnoreParameter return unless indentation? indentation unless indentation == IgnoreParameter true end
foreground_color?(fg)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 39 def foreground_color? fg if fg.nil? match['fg'].nil? and match['brightness'].nil? else brightness, code = Palette.get fg match['fg'].to_i == code + 30 and match['brightness'].to_i == brightness end end
indentation?(indentation)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 49 def indentation? indentation match['indentation'].to_s == ' ' * indentation end
prose?(expected_prose)
click to toggle source
# File lib/test_bench/output/writer/assertions/line.rb, line 53 def prose? expected_prose match['prose'] == expected_prose end