Class: TestMe::Formatter::Console
- Inherits:
-
Object
- Object
- TestMe::Formatter::Console
- Defined in:
- lib/formatter.rb
Instance Method Summary collapse
- #also(desc = nil, stubs = nil, &block) ⇒ Object
- #compile ⇒ Object
- #describe(msg) ⇒ Object
- #given(desc = nil, stubs = nil, &block) ⇒ Object
- #is?(method, actual, expected, success) ⇒ Boolean
-
#test(topic) ⇒ Object
TODO color_scheme.
Instance Method Details
#also(desc = nil, stubs = nil, &block) ⇒ Object
46 47 48 |
# File 'lib/formatter.rb', line 46 def also desc=nil, stubs=nil, &block log " also " + context_to_string(desc, stubs, &block) end |
#compile ⇒ Object
58 59 60 |
# File 'lib/formatter.rb', line 58 def compile #do nothing end |
#describe(msg) ⇒ Object
62 63 64 |
# File 'lib/formatter.rb', line 62 def describe msg log ' ' + msg.bright.yellow end |
#given(desc = nil, stubs = nil, &block) ⇒ Object
42 43 44 |
# File 'lib/formatter.rb', line 42 def given desc=nil, stubs=nil, &block log " given " + context_to_string(desc, stubs, &block) end |
#is?(method, actual, expected, success) ⇒ Boolean
50 51 52 53 54 55 56 |
# File 'lib/formatter.rb', line 50 def is? method, actual, expected, success if method.class == Proc log ' is ' + block_to_string(&method) + '? ' + (success ? 'YES'.bright.green : "NO".bright.red) + "\n\n" else log ' is ' + method.to_s + ', ' + expected.to_s.yellow + '? ' + (success ? 'YES'.bright.green : "NO, it was '#{actual}'".bright.red) + "\n\n" end end |
#test(topic) ⇒ Object
TODO color_scheme
38 39 40 |
# File 'lib/formatter.rb', line 38 def test topic log "\n test ".bright + topic.to_s.bright.color(250, 37, 115) end |