Sha256: a6c65263daef4bbf630ff391c815facf9a2bd860136af974336eaf1f5edb89f2

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

require 'spec_helper'

class Auction < ActiveRecord::Base
  def ring_timeout(was: false)
    created_at + (was ? 10.seconds : 30.seconds)
  end

  publishes :ring, at: :ring_timeout, watch: :name
end

describe Reactor::Eventable do
  describe 'publish' do
    let(:auction) { Auction.create }

    it 'publishes an event with actor_id and actor_type set as self' do
      Reactor::Event.should_receive(:publish).with(:an_event, {what: 'the', actor: auction}).twice
      auction.publish(:an_event, {what: 'the'})
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reactor-0.1.0 spec/models/concerns/eventable_spec.rb
reactor-0.0.1 spec/models/concerns/eventable_spec.rb