Sha256: ebb2284d4e034e44eb21409daec5188d8190fdeb7cf7ef104ba7a3bac1e9ef96
Contents?: true
Size: 1.02 KB
Versions: 61
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' class GoodJob < CanvasSync::Job def perform(argument) end end class EvilError < StandardError; end; class BadJob < CanvasSync::Job def perform(argument) raise EvilError end end RSpec.describe CanvasSync::Job do describe '#perform' do it 'creates a CanvasSync::JobLog and logs relevant data on it' do expect { GoodJob.perform_now("argument") }.to change { CanvasSync::JobLog.count }.by(1) job_log = CanvasSync::JobLog.last expect(job_log.started_at).to_not be_nil expect(job_log.job_class).to eq(GoodJob.to_s) expect(job_log.job_arguments).to eq(["argument"]) expect(job_log.completed_at).to_not be_nil end it 'logs exceptions on the CanvasSync::JobLog and then re-raises' do expect { BadJob.perform_now("argument") }.to raise_exception(StandardError) job_log = CanvasSync::JobLog.last expect(job_log.exception).to eq("EvilError: EvilError") expect(job_log.backtrace).to_not be_nil end end end
Version data entries
61 entries across 61 versions & 1 rubygems