Class: Specwrk::Worker::ProgressFormatter
- Inherits:
-
Object
- Object
- Specwrk::Worker::ProgressFormatter
- Defined in:
- lib/specwrk/worker/progress_formatter.rb
Instance Attribute Summary collapse
-
#final_output ⇒ Object
readonly
Returns the value of attribute final_output.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #dump_failures(notification) ⇒ Object
- #dump_pending(notification) ⇒ Object
- #example_failed(_notification) ⇒ Object
- #example_passed(_notification) ⇒ Object
- #example_pending(_notification) ⇒ Object
-
#initialize(output) ⇒ ProgressFormatter
constructor
A new instance of ProgressFormatter.
Constructor Details
#initialize(output) ⇒ ProgressFormatter
Returns a new instance of ProgressFormatter.
14 15 16 17 18 19 20 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 14 def initialize(output) @output = output @final_output = Tempfile.new @final_output.define_singleton_method(:tty?) { true } @final_output.sync = true end |
Instance Attribute Details
#final_output ⇒ Object (readonly)
Returns the value of attribute final_output.
12 13 14 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 12 def final_output @final_output end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
12 13 14 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 12 def output @output end |
Instance Method Details
#dump_failures(notification) ⇒ Object
34 35 36 37 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 34 def dump_failures(notification) return if notification.failure_notifications.empty? final_output.puts notification.fully_formatted_failed_examples end |
#dump_pending(notification) ⇒ Object
39 40 41 42 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 39 def dump_pending(notification) return if notification.pending_examples.empty? final_output.puts notification.fully_formatted_pending_examples end |
#example_failed(_notification) ⇒ Object
30 31 32 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 30 def example_failed(_notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap("F", :failure) end |
#example_passed(_notification) ⇒ Object
22 23 24 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 22 def example_passed(_notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap(".", :success) end |
#example_pending(_notification) ⇒ Object
26 27 28 |
# File 'lib/specwrk/worker/progress_formatter.rb', line 26 def example_pending(_notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap("*", :pending) end |