Sha256: 39b99574397ab01eb8b83618ec375e4b0bff48ada33d9546fbfdeb929312372c
Contents?: true
Size: 966 Bytes
Versions: 14
Compression:
Stored size: 966 Bytes
Contents
require 'spec_helper' describe Reactor do let(:subscriber) do Reactor.in_test_mode do Class.new(ActiveRecord::Base) do on_event :test_event, -> (event) { self.spy_on_me } end end end describe '.test_mode!' do it 'sets Reactor into test mode' do expect(Reactor.test_mode?).to be_falsey Reactor.test_mode! expect(Reactor.test_mode?).to be_truthy end end context 'in test mode' do before { Reactor.test_mode! } after { Reactor.disable_test_mode! } it 'subscribers created in test mode are disabled' do expect(subscriber).not_to receive :spy_on_me Reactor::Event.publish :test_event end describe '.with_subscriber_enabled' do it 'enables a subscriber during test mode' do expect(subscriber).to receive :spy_on_me Reactor.with_subscriber_enabled(subscriber) do Reactor::Event.publish :test_event end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems