Sha256: ffe6fad47fd1c4fcc46ca9eebd09a28a673c3948b212fbbe08f0904eb471f014
Contents?: true
Size: 841 Bytes
Versions: 13
Compression:
Stored size: 841 Bytes
Contents
require 'spec_helper' class MySubscriber < Reactor::Subscriber attr_accessor :was_called on_fire do self.was_called = true end end describe Reactor::Subscriber do describe 'fire' do subject { MySubscriber.create(event: :you_name_it).fire some: 'random', event: 'data' } its(:message) { should be_a Reactor::Event } its('message.some') { should == 'random' } it 'executes block given' do subject.was_called.should be_true end end describe '.subscribes_to class helper' do end describe 'matcher' do it 'can be set to star to bind to all events' do MySubscriber.create!(event: '*') MySubscriber.any_instance.should_receive(:fire).with(hash_including('random' => 'data', 'event' => 'this_event')) Reactor::Event.publish(:this_event, {random: 'data'}) end end end
Version data entries
13 entries across 13 versions & 1 rubygems