Sha256: 35cb184f0cf02651b0185985bae24e2835637ee10b7d1a35f9d746baba5472e1

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

require 'spec_helper'


class Auction < ActiveRecord::Base
  subscribes_to :bid_made do |event|
    event.target.update_column :status, 'first_bid_made'
  end
end

describe Reactor::Subscribable do

  describe 'subscribes_to' do
    it 'binds block of code statically to event being fired' do
      Auction.any_instance.should_receive(:update_column).with(:status, 'first_bid_made')
      Reactor::Event.publish(:bid_made, target: Auction.create)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reactor-0.3.0 spec/models/concerns/subscribable_spec.rb