sequencer.rb 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. module SequencerUnit
  2. def process(parameters = {}, &block)
  3. Sequencer::Unit.process(described_class.name, parameters, &block)
  4. end
  5. end
  6. module SequencerSequence
  7. def process(parameters = {})
  8. Sequencer.process(described_class.name,
  9. parameters: parameters)
  10. end
  11. end
  12. module SequencerCaller
  13. def expect_sequence(sequence_name = nil)
  14. expected_method_call = receive(:process)
  15. if sequence_name
  16. expected_method_call.with(sequence_name)
  17. end
  18. expect(Sequencer).to expected_method_call
  19. end
  20. def expect_no_sequence(sequence_name = nil)
  21. expected_method_call = receive(:process)
  22. if sequence_name
  23. expected_method_call.with(sequence_name)
  24. end
  25. expect(Sequencer).not_to expected_method_call
  26. end
  27. end
  28. RSpec.configure do |config|
  29. config.include SequencerUnit, sequencer: :unit
  30. config.include SequencerSequence, sequencer: :sequence
  31. config.include SequencerCaller, sequencer: :caller
  32. end