Sha256: c7a19276d9ac1b739026004a0cab90196d4365b8fdf5d69457f3771ad0513079
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
require "rspec/core/formatters/documentation_formatter" module RSpec module TestSpec class Formatter < ::RSpec::Core::Formatters::DocumentationFormatter ::RSpec::Core::Formatters.register( self, :example_started, :example_passed, :example_step_passed, :example_step_pending, :example_step_failed ) # rubocop:disable Metrics/LineLength def example_started(notification) return unless notification.example.metadata[:with_steps] full_message = "#{current_indentation}#{notification.example.description}" output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :default) end def example_passed(notification) super unless notification.example.metadata[:with_steps] end def example_step_passed(notification) full_message = "#{current_indentation} #{notification.type.to_s.capitalize} #{notification.message}" output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :success) end # rubocop:disable Metrics/AbcSize # rubocop:disable Style/ConditionalAssignment def example_step_pending(notification) full_message = "#{current_indentation} #{notification.type.to_s.capitalize} #{notification.message}" if notification.options[:pending] && notification.options[:pending] != true full_message << " (PENDING: #{notification.options[:pending]})" else full_message << " (PENDING)" end output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :pending) end # rubocop:enable Metrics/AbcSize # rubocop:enable Style/ConditionalAssignment def example_step_failed(notification) full_message = "#{current_indentation} #{notification.type.to_s.capitalize} #{notification.message} (FAILED)" output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :failure) end # rubocop:enable Metrics/LineLength end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
test_spec-1.0.0 | lib/test_spec/rspec/formatter.rb |
test_spec-0.1.0 | lib/test_spec/rspec/formatter.rb |