Class: Specjour::Rspec::DistributedFormatter
- Inherits:
-
Spec::Runner::Formatter::BaseTextFormatter
- Object
- Spec::Runner::Formatter::BaseTextFormatter
- Specjour::Rspec::DistributedFormatter
- Defined in:
- lib/specjour/rspec/distributed_formatter.rb
Class Attribute Summary collapse
-
.batch_size ⇒ Object
Returns the value of attribute batch_size.
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#example_count ⇒ Object
readonly
Returns the value of attribute example_count.
-
#failing_examples ⇒ Object
readonly
Returns the value of attribute failing_examples.
-
#failing_messages ⇒ Object
readonly
Returns the value of attribute failing_messages.
-
#failure_count ⇒ Object
readonly
Returns the value of attribute failure_count.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#passing_messages ⇒ Object
readonly
Returns the value of attribute passing_messages.
-
#pending_count ⇒ Object
readonly
Returns the value of attribute pending_count.
-
#pending_examples ⇒ Object
readonly
Returns the value of attribute pending_examples.
-
#pending_messages ⇒ Object
readonly
Returns the value of attribute pending_messages.
Instance Method Summary collapse
- #dump_failure(counter, failure) ⇒ Object
- #dump_pending ⇒ Object
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example, counter, failure) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example, message, deprecated_pending_location = nil) ⇒ Object
-
#initialize(options, output) ⇒ DistributedFormatter
constructor
A new instance of DistributedFormatter.
- #start_dump ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(options, output) ⇒ DistributedFormatter
Returns a new instance of DistributedFormatter.
13 14 15 16 17 18 19 20 21 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 13 def initialize(, output) @options = @output = output @failing_messages = [] @passing_messages = [] @pending_messages = [] @pending_examples = [] @failing_examples = [] end |
Class Attribute Details
.batch_size ⇒ Object
Returns the value of attribute batch_size.
6 7 8 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 6 def batch_size @batch_size end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def duration @duration end |
#example_count ⇒ Object (readonly)
Returns the value of attribute example_count.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def example_count @example_count end |
#failing_examples ⇒ Object (readonly)
Returns the value of attribute failing_examples.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def failing_examples @failing_examples end |
#failing_messages ⇒ Object (readonly)
Returns the value of attribute failing_messages.
10 11 12 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 10 def @failing_messages end |
#failure_count ⇒ Object (readonly)
Returns the value of attribute failure_count.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def failure_count @failure_count end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 10 def output @output end |
#passing_messages ⇒ Object (readonly)
Returns the value of attribute passing_messages.
10 11 12 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 10 def @passing_messages end |
#pending_count ⇒ Object (readonly)
Returns the value of attribute pending_count.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def pending_count @pending_count end |
#pending_examples ⇒ Object (readonly)
Returns the value of attribute pending_examples.
11 12 13 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 11 def pending_examples @pending_examples end |
#pending_messages ⇒ Object (readonly)
Returns the value of attribute pending_messages.
10 11 12 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 10 def @pending_messages end |
Instance Method Details
#dump_failure(counter, failure) ⇒ Object
51 52 53 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 51 def dump_failure(counter, failure) failing_examples << failure end |
#dump_pending ⇒ Object
47 48 49 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 47 def dump_pending #noop end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 39 def dump_summary(duration, example_count, failure_count, pending_count) @duration = duration @example_count = example_count @failure_count = failure_count @pending_count = pending_count output.(:worker_summary=, to_hash) end |
#example_failed(example, counter, failure) ⇒ Object
23 24 25 26 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 23 def example_failed(example, counter, failure) << colorize_failure('F', failure) batch_print() end |
#example_passed(example) ⇒ Object
28 29 30 31 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 28 def example_passed(example) << green('.') batch_print() end |
#example_pending(example, message, deprecated_pending_location = nil) ⇒ Object
33 34 35 36 37 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 33 def example_pending(example, , deprecated_pending_location=nil) super << yellow('*') batch_print() end |
#start_dump ⇒ Object
55 56 57 58 59 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 55 def start_dump print_and_flush print_and_flush print_and_flush end |
#to_hash ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/specjour/rspec/distributed_formatter.rb', line 61 def to_hash h = {} [:duration, :example_count, :failure_count, :pending_count, :pending_examples, :failing_examples].each do |key| h[key] = send(key) end h end |