Sha256: 0835b73fe31c7f55fbdcf59595a4602cf5d1d1179e75b1bdba3ccf8e8a81718f
Contents?: true
Size: 1.46 KB
Versions: 10
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe Taskinator::ProcessWorker do def mock_process(paused=false, cancelled=false) double('process', :paused? => paused, :cancelled? => cancelled) end let(:uuid) { SecureRandom.uuid } subject { Taskinator::ProcessWorker.new(uuid) } it "should fetch the process" do process = mock_process expect(Taskinator::Process).to receive(:fetch).with(uuid) { process } allow(process).to receive(:start!) subject.perform end it "should start the process" do process = mock_process allow(Taskinator::Process).to receive(:fetch).with(uuid) { process } expect(process).to receive(:start!) subject.perform end it "should not start if paused" do process = mock_process(true, false) allow(Taskinator::Process).to receive(:fetch).with(uuid) { process } expect(process).to_not receive(:start!) subject.perform end it "should not start if cancelled" do process = mock_process(false, true) allow(Taskinator::Process).to receive(:fetch).with(uuid) { process } expect(process).to_not receive(:start!) subject.perform end it "should fail if process raises an error" do process = mock_process allow(Taskinator::Process).to receive(:fetch).with(uuid) { process } allow(process).to receive(:start!) { raise NotImplementedError } expect(process).to receive(:fail!).with(NotImplementedError) expect { subject.perform }.to raise_error(NotImplementedError) end end
Version data entries
10 entries across 10 versions & 1 rubygems