Class: Fluff::Rspec::Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- Fluff::Rspec::Formatter
- Defined in:
- lib/fluff/rspec/formatter.rb
Instance Attribute Summary collapse
-
#output_hash ⇒ Object
readonly
Returns the value of attribute output_hash.
Instance Method Summary collapse
- #close(_notification) ⇒ Object
- #dump_summary(summary) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_pending(notification) ⇒ Object
-
#initialize(output) ⇒ Formatter
constructor
A new instance of Formatter.
- #message(notification) ⇒ Object
- #seed(notification) ⇒ Object
- #start(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 15 16 17 |
# File 'lib/fluff/rspec/formatter.rb', line 12 def initialize(output) super @run_uuid = ENV.fetch('FLUFF_RUN_UUID', SecureRandom.uuid) @summary_hash = {} @redis = Redis.new(url: ENV.fetch('FLUFF_REDIS_URL')) end |
Instance Attribute Details
#output_hash ⇒ Object (readonly)
Returns the value of attribute output_hash.
10 11 12 |
# File 'lib/fluff/rspec/formatter.rb', line 10 def output_hash @output_hash end |
Instance Method Details
#close(_notification) ⇒ Object
57 58 59 |
# File 'lib/fluff/rspec/formatter.rb', line 57 def close(_notification) emit @summary_hash end |
#dump_summary(summary) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/fluff/rspec/formatter.rb', line 42 def dump_summary(summary) @summary_hash.merge!( :type => 'summary', :duration => summary.duration, :example_count => summary.example_count, :failure_count => summary.failure_count, :pending_count => summary.pending_count ) end |
#example_failed(notification) ⇒ Object
30 31 32 |
# File 'lib/fluff/rspec/formatter.rb', line 30 def example_failed(notification) emit format_example(notification.example) end |
#example_passed(notification) ⇒ Object
26 27 28 |
# File 'lib/fluff/rspec/formatter.rb', line 26 def example_passed(notification) emit format_example(notification.example) end |
#example_pending(notification) ⇒ Object
34 35 36 |
# File 'lib/fluff/rspec/formatter.rb', line 34 def example_pending(notification) emit format_example(notification.example) end |
#message(notification) ⇒ Object
38 39 40 |
# File 'lib/fluff/rspec/formatter.rb', line 38 def (notification) emit :type => 'message', :message => notification. end |
#seed(notification) ⇒ Object
52 53 54 55 |
# File 'lib/fluff/rspec/formatter.rb', line 52 def seed(notification) return unless notification.seed_used? @summary_hash[:seed] = notification.seed end |
#start(notification) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/fluff/rspec/formatter.rb', line 19 def start(notification) emit( :type => 'start', :version => RSpec::Core::Version::STRING ) end |