Sha256: da21606f8185789790050f11addd593b41ee48ceadbe0a5b54b8b13578e29ea7
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe Harvestdor::Indexer::Metrics do it 'records successes' do expect { subject.success! }.to change { subject.success_count }.from(0).to(1) end it 'records errors' do expect { subject.error! }.to change { subject.error_count }.from(0).to(1) end describe '#total' do it 'is the sum of the successes and errors' do expect do subject.error! subject.success! end.to change { subject.total }.from(0).to(2) end end describe '#tally' do it "records a success if the block doesn't fail" do expect do subject.tally do # noop end end.to change { subject.success_count }.from(0).to(1) end it 'records an error if the block fails' do expect do subject.tally do raise 'Broken' end end.to change { subject.error_count }.from(0).to(1) end it 'allows an error handler to be provided' do x = double expect(x).to receive(:call).with(kind_of(RuntimeError)) subject.tally(on_error: x) do raise 'Broken' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems