trabajo-afectivo/spec/lib/stats_spec.rb
Thorsten Eckel ca56de3648 Maintenance: Updated to Rails 6.0.4 and the new Zeitwerk autoloader.
This changes the minimum supported version of PostgreSQL to 9.3.
2021-06-23 11:35:27 +00:00

32 lines
792 B
Ruby

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe Stats do
describe '#generate' do
before do
# create a user for which the stats can be generated
create(:agent)
end
it 'generates stats' do
expect { described_class.generate }.not_to raise_error
end
context 'when backend registration is invalid' do
it 'fails for empty registration' do
Setting.set('Stats::TicketWaitingTime', nil)
expect { described_class.generate }.to raise_error(RuntimeError)
end
it 'fails for unknown backend' do
Setting.set('Stats::TicketWaitingTime', 'Stats::UNKNOWN')
expect { described_class.generate }.to raise_error(NameError)
end
end
end
end