Class: Rpruby::Cucumber::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rpruby/cucumber/formatter.rb

Direct Known Subclasses

ParallelFormatter

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Formatter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Formatter.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rpruby/cucumber/formatter.rb', line 9

def initialize(config)
  ENV['REPORT_PORTAL_USED'] = 'true'

  setup_message_processing

  @io = config.out_stream

  @ast_lookup = if (::Cucumber::VERSION.split('.').map(&:to_i) <=> CucumberMessagesVersion) > 0
                  require 'cucumber/formatter/ast_lookup'
                  ::Cucumber::Formatter::AstLookup.new(config)
                else
                  nil
                end

  %i[test_case_started test_case_finished test_step_started test_step_finished test_run_finished].each do |event_name|
    config.on_event event_name do |event|
      process_message(event_name, event)
    end
  end
  config.on_event(:test_run_finished) { finish_message_processing }
end

Instance Method Details

#embed(*args) ⇒ Object



37
38
39
# File 'lib/rpruby/cucumber/formatter.rb', line 37

def embed(*args)
  process_message(:embed, *args)
end

#puts(message) ⇒ Object



31
32
33
34
35
# File 'lib/rpruby/cucumber/formatter.rb', line 31

def puts(message)
  process_message(:puts, message)
  @io.puts(message)
  @io.flush
end