Sha256: 5063f8316cbede65abc3702d01c51e881a548eb7437a593e5af9b81efa981184
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe RCelery::Worker do include RR::Adapters::RRMethods before(:each) do @channel, @queue = stub_amqp end after :each do RCelery.stop end describe '.start' do it 'sends a worker online event' do mock(RCelery::Events).worker_online('rcelery',RCelery::VERSION,RUBY_PLATFORM) stub(RCelery::Events).worker_offline pool = RCelery::Pool.new worker = RCelery::Worker.new stub(worker).subscribe worker.start pool worker.stop end end describe '.stop' do it 'sends a worker offline event' do stub(RCelery::Events).worker_online mock(RCelery::Events).worker_offline('rcelery',RCelery::VERSION,RUBY_PLATFORM) pool = RCelery::Pool.new worker = RCelery::Worker.new stub(worker).subscribe worker.start pool worker.stop end it 'stops the heartbeat' do stub(RCelery::Events).worker_online stub(RCelery::Events).worker_offline pool = RCelery::Pool.new worker = RCelery::Worker.new stub(worker).subscribe worker.start pool worker.instance_variable_set(:@heartbeat_timer, mock!.cancel.subject) worker.stop end end def fuzzy_hash(expected) proc do |arg| parsed = JSON.parse(arg) good = true parsed.each do |k,v| next if v.to_s == expected[k].to_s good = false end good end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rcelery-1.0.1 | spec/unit/worker_spec.rb |
rcelery-1.0.0 | spec/unit/worker_spec.rb |