Class: RubyCI::RspecDryrunFormatter
- Inherits:
-
Object
- Object
- RubyCI::RspecDryrunFormatter
- Defined in:
- lib/ruby_ci/rspec_dryrun_formatter.rb
Instance Method Summary collapse
- #close(*args) ⇒ Object
- #dump_summary(summary_notification) ⇒ Object
- #example_failed(example_notification) ⇒ Object
- #example_group_finished(_group_notification) ⇒ Object
- #example_group_started(group_notification) ⇒ Object
- #example_passed(example_notification) ⇒ Object
- #example_pending(example_notification) ⇒ Object
-
#initialize(output) ⇒ RspecDryrunFormatter
constructor
A new instance of RspecDryrunFormatter.
- #message(message_notification) ⇒ Object
- #start(example_count) ⇒ Object
- #start_dump(_notification) ⇒ Object
- #time_frozen? ⇒ Boolean
- #time_now ⇒ Object
Constructor Details
#initialize(output) ⇒ RspecDryrunFormatter
Returns a new instance of RspecDryrunFormatter.
16 17 18 19 20 21 22 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 16 def initialize(output) @output = output @current_group_path = [] @current_file = nil @current_file_count = 0 @events = [] end |
Instance Method Details
#close(*args) ⇒ Object
37 38 39 40 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 37 def close(*args) msg(:close, { "timestamp" => time_now }) send_events end |
#dump_summary(summary_notification) ⇒ Object
42 43 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 42 def dump_summary(summary_notification) end |
#example_failed(example_notification) ⇒ Object
59 60 61 62 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 59 def example_failed(example_notification) example_finished(example_notification) @output.print RSpec::Core::Formatters::ConsoleCodes.wrap('F', :failure) end |
#example_group_finished(_group_notification) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 73 def example_group_finished(_group_notification) @current_group_path.pop if @current_group_path.empty? # its a file msg(:file_examples_count, [@current_file, @current_file_count]) @current_file_count = 0 @current_file = nil end end |
#example_group_started(group_notification) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 82 def example_group_started(group_notification) if @current_group_path.size == 0 @current_file = group_notification.group.[:file_path].gsub("./".freeze, "".freeze) @current_file_count = 0 end @current_group_path << 1 end |
#example_passed(example_notification) ⇒ Object
54 55 56 57 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 54 def example_passed(example_notification) example_finished(example_notification) @output.print RSpec::Core::Formatters::ConsoleCodes.wrap('.', :success) end |
#example_pending(example_notification) ⇒ Object
64 65 66 67 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 64 def example_pending(example_notification) example_finished(example_notification) @output.print RSpec::Core::Formatters::ConsoleCodes.wrap('*', :pending) end |
#message(message_notification) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 24 def () if ..include?('An error occurred') msg(:message, Base64.strict_encode64("\nAn error occurred#{.}")) send_events end @output.print . @output.print "\n" end |
#start(example_count) ⇒ Object
33 34 35 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 33 def start(example_count) msg(:start, { "example_count" => example_count.count, "timestamp" => time_now }) end |
#start_dump(_notification) ⇒ Object
69 70 71 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 69 def start_dump(_notification) @output.print "\n" end |
#time_frozen? ⇒ Boolean
49 50 51 52 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 49 def time_frozen? return unless defined?(Timecop) Timecop.frozen? end |
#time_now ⇒ Object
45 46 47 |
# File 'lib/ruby_ci/rspec_dryrun_formatter.rb', line 45 def time_now time_frozen? ? Timecop.return { Time.now } : Time.now end |