Add coverage for StatusTrend
and PreviewCardTrend
models, add locales
class method to RankedTrend
(#32688)
This commit is contained in:
parent
df3b954720
commit
babee06794
9 changed files with 64 additions and 4 deletions
5
spec/fabricators/preview_card_trend_fabricator.rb
Normal file
5
spec/fabricators/preview_card_trend_fabricator.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:preview_card_trend) do
|
||||
preview_card
|
||||
end
|
6
spec/fabricators/status_trend_fabricator.rb
Normal file
6
spec/fabricators/status_trend_fabricator.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:status_trend) do
|
||||
status
|
||||
account
|
||||
end
|
22
spec/models/preview_card_trend_spec.rb
Normal file
22
spec/models/preview_card_trend_spec.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PreviewCardTrend do
|
||||
describe 'Associations' do
|
||||
it { is_expected.to belong_to(:preview_card).required }
|
||||
end
|
||||
|
||||
describe '.locales' do
|
||||
before do
|
||||
Fabricate :preview_card_trend, language: 'en'
|
||||
Fabricate :preview_card_trend, language: 'en'
|
||||
Fabricate :preview_card_trend, language: 'es'
|
||||
end
|
||||
|
||||
it 'returns unique set of languages' do
|
||||
expect(described_class.locales)
|
||||
.to eq(['en', 'es'])
|
||||
end
|
||||
end
|
||||
end
|
23
spec/models/status_trend_spec.rb
Normal file
23
spec/models/status_trend_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StatusTrend do
|
||||
describe 'Associations' do
|
||||
it { is_expected.to belong_to(:account).required }
|
||||
it { is_expected.to belong_to(:status).required }
|
||||
end
|
||||
|
||||
describe '.locales' do
|
||||
before do
|
||||
Fabricate :status_trend, language: 'en'
|
||||
Fabricate :status_trend, language: 'en'
|
||||
Fabricate :status_trend, language: 'es'
|
||||
end
|
||||
|
||||
it 'returns unique set of languages' do
|
||||
expect(described_class.locales)
|
||||
.to eq(['en', 'es'])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue