Sha256: c47a31159571ec8b05d16274c086572fa6cc6c24c619adafe05aeaefd0d9a800
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
require 'wisper/sidekiq' require_relative 'dummy_app/app' require 'sidekiq/api' RSpec.describe 'integration tests:' do let(:publisher) do Class.new do include Wisper::Publisher def run broadcast(:it_happened, { hello: 'world' }) end end.new end let(:shared_content) { File.read('/tmp/shared') } def ensure_sidekiq_was_running Timeout.timeout(10) do while !File.exist?('/tmp/shared') sleep(0.1) end end end before do Sidekiq::Testing.disable! Sidekiq::Queue.new.clear Sidekiq::RetrySet.new.clear File.delete('/tmp/shared') if File.exist?('/tmp/shared') end it 'performs event in a different process' do publisher.subscribe(Subscriber, async: Wisper::SidekiqBroadcaster.new) publisher.run ensure_sidekiq_was_running expect(shared_content).not_to include("pid: #{Process.pid}\n") end it 'performs event' do publisher.subscribe(Subscriber, async: Wisper::SidekiqBroadcaster.new) publisher.run ensure_sidekiq_was_running expect(shared_content).to include('{:hello=>"world"}') end end
Version data entries
6 entries across 6 versions & 2 rubygems