Sha256: e88bcc32d3621f91ce51ddf5ebe34f1c915f3f27d5a076ffc1c3a5234144d9ba
Contents?: true
Size: 797 Bytes
Versions: 3
Compression:
Stored size: 797 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_name: :you_name_it).fire some: 'random', event: 'data' } its(:event) { should be_a Reactor::Event } its('event.some') { should == 'random' } it 'executes block given' do subject.was_called.should be_true end end describe 'matcher' do it 'can be set to star to bind to all events' do MySubscriber.create!(event_name: '*') 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reactor-0.8.0 | spec/models/subscriber_spec.rb |
reactor-0.7.1 | spec/models/subscriber_spec.rb |
reactor-0.7.0 | spec/models/subscriber_spec.rb |