Skip to content

Instantly share code, notes, and snippets.

@mreinsch
Created March 3, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mreinsch/2c8dbb01e51c32c3c5c8 to your computer and use it in GitHub Desktop.
Save mreinsch/2c8dbb01e51c32c3c5c8 to your computer and use it in GitHub Desktop.
log details on test runs to log to make it easier to understand what is going on
module RSpecLoggerListener
extend self
def start(notification)
Rails.logger.info("\n\n====== Starting new test run")
end
def stop(notification)
Rails.logger.info("\n\n====== Test run finished")
end
def example_started(notification)
Rails.logger.info("\n\n====== START #{notification.example.full_description}")
end
def example_passed(notification)
Rails.logger.info("====== PASSED #{notification.example.full_description}")
end
def example_failed(notification)
Rails.logger.info("====== FAILED #{notification.example.full_description}")
end
def example_pending(notification)
Rails.logger.info("====== PENDING #{notification.example.full_description}")
end
end
RSpec.configuration.reporter.register_listener(RSpecLoggerListener,
:start, :stop, :example_started, :example_passed,
:example_failed, :example_pending)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment