Sha256: 4fc3df214c74d50a87f52092c4e8013393faf5b6d811619023f831e763d551a7

Contents?: true

Size: 647 Bytes

Versions: 6

Compression:

Stored size: 647 Bytes

Contents

RSpec::Matchers.define :trigger_event do |event|
  match do |command|
    # PassiveRecord.drop_all
    Simulation.current.clear!
    Simulation.current.apply(command)
    Simulation.current.events.include?(event)
  end

  failure_message do |command|
    "expected that #{command.inspect} would trigger #{event.inspect}! Actual events were: #{Simulation.current.events}"
  end
end

RSpec::Matchers.define :trigger_events do |*events|
  match do |command|
    # PassiveRecord.drop_all
    Simulation.current.clear!

    Simulation.current.apply(command)

    events.all? do |event|
      Simulation.current.events.include?(event)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metacosm-0.2.4 lib/metacosm/support/spec_harness.rb
metacosm-0.2.3 lib/metacosm/support/spec_harness.rb
metacosm-0.2.2 lib/metacosm/support/spec_harness.rb
metacosm-0.2.1 lib/metacosm/support/spec_harness.rb
metacosm-0.2.0 lib/metacosm/support/spec_harness.rb
metacosm-0.1.8 lib/metacosm/support/spec_harness.rb