Sha256: bc669b2bdd3512dc312d8bb80149392395ccf4bf1e4890891d9ca978be342e09

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

require 'spec_helper'

describe Reactor::Event do

  let(:event_name) { :user_did_this }

  describe 'publish' do
    it 'fires the first process and sets message event_id' do
      Reactor::Event.should_receive(:process).with(event_name, 'actor_id' => '1', 'event' => :user_did_this)
      Reactor::Event.publish(:user_did_this, actor_id: '1')
    end
  end

  describe 'process' do
    it 'fires all subscribers' do
      Reactor::Subscriber.create(event: :user_did_this)
      Reactor::Subscriber.any_instance.should_receive(:fire).with(actor_id: '1')
      Reactor::Event.process(event_name, actor_id: '1')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reactor-0.0.1 spec/event_spec.rb