Class: CucumberGithubFormatter
- Inherits:
-
Object
- Object
- CucumberGithubFormatter
- Defined in:
- lib/cucumber_github_formatter.rb
Overview
Main formatter class
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
-
#initialize(config) ⇒ CucumberGithubFormatter
constructor
A new instance of CucumberGithubFormatter.
-
#print_github_message(event) ⇒ Object
rubocop:disable Metrics/MethodLength,Metrics/AbcSize.
Constructor Details
#initialize(config) ⇒ CucumberGithubFormatter
Returns a new instance of CucumberGithubFormatter.
7 8 9 |
# File 'lib/cucumber_github_formatter.rb', line 7 def initialize(config) config.on_event :test_case_finished, &method(:print_github_message) end |
Instance Method Details
#print_github_message(event) ⇒ Object
rubocop:disable Metrics/MethodLength,Metrics/AbcSize
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cucumber_github_formatter.rb', line 11 def (event) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize if event.result.failed? status = 'error' = 'failed: ' + event.result.exception..to_s file, line = event.result.exception.backtrace.last.split(':') elsif event.result.pending? status = 'warning' = 'pending' file = event.test_case.location.file line = event.test_case.location.lines.to_s else return end name = event.test_case.name puts "::#{status} file=#{file},line=#{line}::#{name} #{}" end |