Class: Neospec::Logger::Basic
- Inherits:
-
Object
- Object
- Neospec::Logger::Basic
- Defined in:
- lib/neospec/logger/basic.rb
Instance Method Summary collapse
-
#initialize(output: $stdout) ⇒ Basic
constructor
A new instance of Basic.
- #log(message, context: nil, result: nil) ⇒ Object
Constructor Details
#initialize(output: $stdout) ⇒ Basic
Returns a new instance of Basic.
4 5 6 |
# File 'lib/neospec/logger/basic.rb', line 4 def initialize(output: $stdout) @output = output end |
Instance Method Details
#log(message, context: nil, result: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/neospec/logger/basic.rb', line 8 def log(, context: nil, result: nil) case context when :describe @output.puts "#{Neospec::Color::BLUE}#{}#{Neospec::Color::RESET}" when :expect str = " " str << (result.successful? ? "#{Neospec::Color::GREEN}✓" : "#{Neospec::Color::RED}✗") str << " #{context} #{}#{Neospec::Color::RESET}" @output.puts str when :error @output.puts " #{Neospec::Color::RED}✗ #{}#{Neospec::Color::RESET}" else @output.puts " #{context} #{}" end end |