2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-08-14 11:56:23 +00:00
|
|
|
module SequencerUnit
|
|
|
|
|
2018-01-08 15:27:23 +00:00
|
|
|
def process(parameters = {}, &block)
|
2017-08-14 11:56:23 +00:00
|
|
|
Sequencer::Unit.process(described_class.name, parameters, &block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module SequencerSequence
|
|
|
|
|
|
|
|
def process(parameters = {})
|
|
|
|
Sequencer.process(described_class.name,
|
|
|
|
parameters: parameters)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-01-08 15:27:23 +00:00
|
|
|
module SequencerCaller
|
|
|
|
|
|
|
|
def expect_sequence(sequence_name = nil)
|
|
|
|
|
|
|
|
expected_method_call = receive(:process)
|
|
|
|
if sequence_name
|
|
|
|
expected_method_call.with(sequence_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(Sequencer).to expected_method_call
|
|
|
|
end
|
|
|
|
|
|
|
|
def expect_no_sequence(sequence_name = nil)
|
|
|
|
|
|
|
|
expected_method_call = receive(:process)
|
|
|
|
if sequence_name
|
|
|
|
expected_method_call.with(sequence_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(Sequencer).not_to expected_method_call
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-08-14 11:56:23 +00:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include SequencerUnit, sequencer: :unit
|
|
|
|
config.include SequencerSequence, sequencer: :sequence
|
2018-01-08 15:27:23 +00:00
|
|
|
config.include SequencerCaller, sequencer: :caller
|
2017-08-14 11:56:23 +00:00
|
|
|
end
|