Module: Rack::ClientSpec::Printer
- Defined in:
- lib/rack/client_spec/printer.rb
Class Method Summary collapse
- .print_fail(name, result) ⇒ Object
- .print_initialized ⇒ Object
- .print_states(states) ⇒ Object
- .print_success(name) ⇒ Object
Class Method Details
.print_fail(name, result) ⇒ Object
32 33 34 35 |
# File 'lib/rack/client_spec/printer.rb', line 32 def print_fail(name, result) puts ANSI.black_on_red{ " FAIL " } + " #{name}" puts result.error.to_s end |
.print_initialized ⇒ Object
6 7 8 |
# File 'lib/rack/client_spec/printer.rb', line 6 def print_initialized puts ANSI.white_on_blue{ " ClientSpec " } + ANSI.black_on_green{ " version #{Rack::ClientSpec::VERSION} " } end |
.print_states(states) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rack/client_spec/printer.rb', line 10 def print_states(states) puts ANSI.white_on_blue{ " ClientSpec " } + ANSI.black_on_yellow{ " EXPECT REQUEST SEQUENCE (#{states.size}) " } states.each do |name, sequence| state = "" sequence.each do |req| state += ANSI.yellow{ " -> " } if req[:passed] state += ANSI.black_on_green { req[:request].desc } else state += ANSI.white { req[:request].desc } end end puts " - #{name}:#{state}" end puts "" end |
.print_success(name) ⇒ Object
28 29 30 |
# File 'lib/rack/client_spec/printer.rb', line 28 def print_success(name) puts ANSI.black_on_green{ " SUCCESS " } + " #{name}" end |