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.



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

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



44
45
46
47
# File 'lib/sequent/test/event_stream_helpers.rb', line 44

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.



37
38
39
# File 'lib/sequent/test/event_stream_helpers.rb', line 37

def events
  @events
end