class Swat::Capybara::RspecSetup::SwatFormatter
Constants
- START_MESSAGE
Public Class Methods
new(arg)
click to toggle source
Calls superclass method
# File lib/swat/capybara/rspec_setup.rb, line 24 def initialize(arg) super @swat_logger = TarvitHelpers::ConditionalLogger.new do !ENV['SWAT_LOGS_DISABLED'] end end
Public Instance Methods
example_failed(notification)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 45 def example_failed(notification) @swat_logger.puts "\n[FAILED] #{ notification.example.description } (#{ finished_in(notification.example) })".red end
example_passed(notification)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 41 def example_passed(notification) @swat_logger.puts "\n[PASSED] #{ notification.example.description } (#{ finished_in(notification.example) })".green end
example_started(notification)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 35 def example_started(notification) @started = Time.now example_type = (notification.example.metadata[:type] || 'test').to_s.upcase @swat_logger.puts "\n[#{example_type}] #{notification.example.description}".yellow end
start(notification)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 31 def start(notification) @swat_logger.puts START_MESSAGE.blue end
stop(notification)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 49 def stop(notification) # Do nothing end
Private Instance Methods
finished_in(example)
click to toggle source
# File lib/swat/capybara/rspec_setup.rb, line 55 def finished_in(example) test_duration = Time.at(example.metadata[:execution_result].run_time) Time.at(test_duration).utc.strftime("%H:%M:%S") end