2019-12-06 04:06:39 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 02:09:01 -04:00
|
|
|
RSpec.describe SentryErrorPresenter do
|
2019-12-06 04:06:39 -05:00
|
|
|
let(:error) { build(:detailed_error_tracking_error) }
|
|
|
|
let(:presenter) { described_class.new(error) }
|
|
|
|
|
|
|
|
describe '#frequency' do
|
|
|
|
subject { presenter.frequency }
|
|
|
|
|
|
|
|
it 'returns an array of frequency structs' do
|
2020-01-29 07:09:08 -05:00
|
|
|
expect(subject).to include(a_kind_of(SentryErrorPresenter::FrequencyStruct))
|
2019-12-06 04:06:39 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'converts the times into UTC time objects' do
|
|
|
|
time = subject.first.time
|
|
|
|
|
|
|
|
expect(time).to be_a(Time)
|
|
|
|
expect(time.strftime('%z')).to eq '+0000'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns the correct counts' do
|
|
|
|
count = subject.first.count
|
|
|
|
|
|
|
|
expect(count).to eq error.frequency.first[1]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|