Class: Sequent::Test::EventStreamHelpers::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/sequent/test/event_stream_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aggregate_id) ⇒ Builder

Returns a new instance of Builder.



41
42
43
44
# File 'lib/sequent/test/event_stream_helpers.rb', line 41

def initialize(aggregate_id)
  @aggregate_id = aggregate_id
  @events = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

rubocop:disable Style/MissingRespondToMissing



47
48
49
50
# File 'lib/sequent/test/event_stream_helpers.rb', line 47

def method_missing(name, *args, &block)
  args = prepare_arguments(args)
  @events << FactoryBot.build(name, *args, &block)
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



39
40
41
# File 'lib/sequent/test/event_stream_helpers.rb', line 39

def events
  @events
end