Sha256: 5e749cad495b0d972a70b8453f847284efbe2385b702c47d52c2757715861077

Contents?: true

Size: 717 Bytes

Versions: 16

Compression:

Stored size: 717 Bytes

Contents

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

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

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

    Metacosm::Simulation.current.apply(command)

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
metacosm-0.3.7 lib/metacosm/support/spec_harness.rb
metacosm-0.3.6 lib/metacosm/support/spec_harness.rb
metacosm-0.3.5 lib/metacosm/support/spec_harness.rb
metacosm-0.3.4 lib/metacosm/support/spec_harness.rb
metacosm-0.3.3 lib/metacosm/support/spec_harness.rb
metacosm-0.3.2 lib/metacosm/support/spec_harness.rb
metacosm-0.3.1 lib/metacosm/support/spec_harness.rb
metacosm-0.3.0 lib/metacosm/support/spec_harness.rb
metacosm-0.2.14 lib/metacosm/support/spec_harness.rb
metacosm-0.2.13 lib/metacosm/support/spec_harness.rb
metacosm-0.2.12 lib/metacosm/support/spec_harness.rb
metacosm-0.2.11 lib/metacosm/support/spec_harness.rb
metacosm-0.2.10 lib/metacosm/support/spec_harness.rb
metacosm-0.2.9 lib/metacosm/support/spec_harness.rb
metacosm-0.2.8 lib/metacosm/support/spec_harness.rb
metacosm-0.2.7 lib/metacosm/support/spec_harness.rb