Sha256: 04bb152e03a143b574dad4d5c1fe40c015ff2ec0943f24adc5efa6d51e7dc887

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

RSpec::Matchers.define :publish_event do |name, data = {}|

  match do |block|
    defaults = {:actor => anything, :target => anything}
    Reactor::Event.should_receive(:publish).with(name, defaults.merge(data))
    block.call
  end
end

RSpec::Matchers.define :publish_events do |*args|

  match do |block|
    defaults = {:actor => anything, :target => anything}

    args.each do |event|
      case event
        when Symbol
          Reactor::Event.should_receive(:publish).with(event, anything)
        when Hash
          Reactor::Event.should_receive(:publish).with(event.keys.first, defaults.merge(event.values.first))
      end
    end
    block.call
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reactor-0.2.7 lib/reactor/testing/matchers.rb