Class: Flatware::RSpec::Checkpoint
- Inherits:
-
Object
- Object
- Flatware::RSpec::Checkpoint
- Extended by:
- Forwardable
- Defined in:
- lib/flatware/rspec/checkpoint.rb
Overview
Marshalable container for the run details from a worker. Can be added to other checkpoints to create a final run summary.
Constant Summary collapse
- EVENTS =
%i[ deprecation dump_failures dump_pending dump_profile dump_summary ].freeze
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Class Method Summary collapse
Instance Method Summary collapse
- #+(other) ⇒ Object
- #deprecations ⇒ Object
-
#initialize(events = {}) ⇒ Checkpoint
constructor
A new instance of Checkpoint.
- #profile ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(events = {}) ⇒ Checkpoint
Returns a new instance of Checkpoint.
28 29 30 |
# File 'lib/flatware/rspec/checkpoint.rb', line 28 def initialize(events = {}) @events = { deprecation: [] }.merge(events) end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
26 27 28 |
# File 'lib/flatware/rspec/checkpoint.rb', line 26 def events @events end |
Class Method Details
.listen_for(event, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/flatware/rspec/checkpoint.rb', line 32 def self.listen_for(event, &block) define_method(event) do |notification| instance_exec(Marshalable.for_event(event).from_rspec(notification), &block) end end |
Instance Method Details
#+(other) ⇒ Object
48 49 50 |
# File 'lib/flatware/rspec/checkpoint.rb', line 48 def +(other) self.class.new(events.merge(other.events) { |_, event, other_event| event + other_event }) end |
#deprecations ⇒ Object
56 57 58 |
# File 'lib/flatware/rspec/checkpoint.rb', line 56 def deprecations events.fetch(:deprecation) end |
#profile ⇒ Object
60 61 62 |
# File 'lib/flatware/rspec/checkpoint.rb', line 60 def profile events[:dump_profile] end |
#summary ⇒ Object
52 53 54 |
# File 'lib/flatware/rspec/checkpoint.rb', line 52 def summary events.fetch(:dump_summary) end |