mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-25 20:45:03 +01:00
Improve spec for dimension/languages admin metric (#29842)
This commit is contained in:
parent
6ac90d4c5d
commit
59da591d13
@ -3,7 +3,7 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Admin::Metrics::Dimension::LanguagesDimension do
|
describe Admin::Metrics::Dimension::LanguagesDimension do
|
||||||
subject(:dimension) { described_class.new(start_at, end_at, limit, params) }
|
subject { described_class.new(start_at, end_at, limit, params) }
|
||||||
|
|
||||||
let(:start_at) { 2.days.ago }
|
let(:start_at) { 2.days.ago }
|
||||||
let(:end_at) { Time.now.utc }
|
let(:end_at) { Time.now.utc }
|
||||||
@ -11,8 +11,21 @@ describe Admin::Metrics::Dimension::LanguagesDimension do
|
|||||||
let(:params) { ActionController::Parameters.new }
|
let(:params) { ActionController::Parameters.new }
|
||||||
|
|
||||||
describe '#data' do
|
describe '#data' do
|
||||||
it 'runs data query without error' do
|
let(:alice) { Fabricate(:user, locale: 'en', current_sign_in_at: 1.day.ago) }
|
||||||
expect { dimension.data }.to_not raise_error
|
let(:bob) { Fabricate(:user, locale: 'en', current_sign_in_at: 30.days.ago) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
alice.update(current_sign_in_at: 1.day.ago)
|
||||||
|
bob.update(current_sign_in_at: 30.days.ago)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns locales with sign in counts' do
|
||||||
|
expect(subject.data.size)
|
||||||
|
.to eq(1)
|
||||||
|
expect(subject.data.map(&:symbolize_keys))
|
||||||
|
.to contain_exactly(
|
||||||
|
include(key: 'en', value: '1')
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user