Sha256: 8c5ab0efdd6ae649ddf15458c3c21e62bafb872df384f0bf9ab5368d95650264

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

require 'spec_helper'

describe EventAggregator::MessageJob do
	let(:callback)    { lambda{ |data| } }
	let(:data)        { Faker::Name.name }
	let(:message_job) { EventAggregator::MessageJob.new }

	describe '.perform' do
		describe 'legal parameters' do
			it 'excute callback with data' do
				expect(callback).to receive(:call).with(data)
				
				message_job.perform(data, callback)
			end
			it "should recover from failing callback" do
				expect(callback).to receive(:call).and_raise("error")
				allow(STDERR).to receive(:puts)
				expect{message_job.perform(data,callback)}.to_not raise_error
			end
		end
		describe 'illegal parameters' do
			it 'should never be passed to MessageJob' do
				expect(true).to eq(true)
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event_aggregator-1.1.6 spec/lib/event_aggregator/message_job_spec.rb