spec/betterlog/log_spec.rb in betterlog-0.3.0 vs spec/betterlog/log_spec.rb in betterlog-0.4.0
- old
+ new
@@ -152,29 +152,30 @@
end
end
class MyEx < StandardError
def backtrace
- []
+ %w[ backtrace ]
end
end
it 'adds exception information if block raises' do
expected_event = Log::Event.new(
metric: 'foo',
type: 'seconds',
- value: 10.0,
- timestamp: "2011-11-11T10:11:21.000Z",
- message: 'MyEx: we were fucked while measuring metric foo',
+ value: 3.0,
+ timestamp: "2011-11-11T10:11:14.000Z",
+ message: '"MyEx: we were fucked" while measuring metric foo',
error_class: 'MyEx',
- backtrace: [],
+ backtrace: %w[ backtrace ]
)
expect(instance).to receive(:emit).with(expected_event)
raised = false
begin
Log.measure(metric: 'foo') do
- Time.dummy = Time.now + 10
+ Time.dummy = Time.now + 3
raise MyEx, "we were fucked"
+ Time.dummy = Time.now + 7
end
rescue MyEx
raised = true
end
expect(raised).to eq true