2014-08-30 17:38:47 +00:00
|
|
|
require 'rails_helper'
|
2013-09-10 19:29:17 +00:00
|
|
|
|
|
|
|
describe AsciicastWorker do
|
|
|
|
|
|
|
|
let(:worker) { described_class.new }
|
|
|
|
|
|
|
|
describe '#perform' do
|
|
|
|
let(:asciicast) { double('asciicast') }
|
|
|
|
let(:asciicast_processor) { double('asciicast_processor', :process => nil) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(Asciicast).to receive(:find).with(123) { asciicast }
|
2013-09-21 11:11:36 +00:00
|
|
|
allow(AsciicastProcessor).to receive(:new).
|
|
|
|
with(no_args) { asciicast_processor }
|
2013-09-10 19:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'processes given asciicast with AsciicastProcessor' do
|
|
|
|
worker.perform(123)
|
|
|
|
|
|
|
|
expect(asciicast_processor).to have_received(:process).with(asciicast)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|