Class: Flatware::RSpec::Formatters::Console
- Inherits:
-
Object
- Object
- Flatware::RSpec::Formatters::Console
- Defined in:
- lib/flatware/rspec/formatters/console.rb
Instance Attribute Summary collapse
-
#deprecation_stream ⇒ Object
readonly
Returns the value of attribute deprecation_stream.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
-
#progress_formatter ⇒ Object
readonly
Returns the value of attribute progress_formatter.
Instance Method Summary collapse
-
#initialize(out, deprecation_stream: StringIO.new) ⇒ Console
constructor
A new instance of Console.
- #message(message) ⇒ Object
- #progress(result) ⇒ Object
- #summarize(checkpoints) ⇒ Object
- #summarize_remaining(remaining) ⇒ Object
Constructor Details
#initialize(out, deprecation_stream: StringIO.new) ⇒ Console
Returns a new instance of Console.
9 10 11 12 13 14 |
# File 'lib/flatware/rspec/formatters/console.rb', line 9 def initialize(out, deprecation_stream: StringIO.new) @out = out @deprecation_stream = deprecation_stream ::RSpec.configuration.backtrace_exclusion_patterns += [%r{/lib/flatware/worker}, %r{/lib/flatware/rspec}] @progress_formatter = ::RSpec::Core::Formatters::ProgressFormatter.new(out) end |
Instance Attribute Details
#deprecation_stream ⇒ Object (readonly)
Returns the value of attribute deprecation_stream.
7 8 9 |
# File 'lib/flatware/rspec/formatters/console.rb', line 7 def deprecation_stream @deprecation_stream end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
7 8 9 |
# File 'lib/flatware/rspec/formatters/console.rb', line 7 def out @out end |
#progress_formatter ⇒ Object (readonly)
Returns the value of attribute progress_formatter.
7 8 9 |
# File 'lib/flatware/rspec/formatters/console.rb', line 7 def progress_formatter @progress_formatter end |
Instance Method Details
#message(message) ⇒ Object
20 21 22 |
# File 'lib/flatware/rspec/formatters/console.rb', line 20 def () out.puts(.) end |
#progress(result) ⇒ Object
16 17 18 |
# File 'lib/flatware/rspec/formatters/console.rb', line 16 def progress(result) progress_formatter.public_send((result), nil) end |
#summarize(checkpoints) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/flatware/rspec/formatters/console.rb', line 24 def summarize(checkpoints) return if checkpoints.empty? result = checkpoints.reduce :+ progress_formatter.dump_pending(result) if result.pending_examples.any? progress_formatter.dump_failures(result) dump_deprecations(result.deprecations) dump_profile(result.profile) if result.profile progress_formatter.dump_summary(result.summary) end |
#summarize_remaining(remaining) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/flatware/rspec/formatters/console.rb', line 36 def summarize_remaining(remaining) out.puts(colorizer.wrap(<<~MESSAGE, :detail)) The following specs weren't run: #{spec_list(remaining)} MESSAGE end |