1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Use fabricator in follow_spec (#30642)

This commit is contained in:
Matt Jankowski 2024-06-11 02:57:09 -04:00 committed by GitHub
parent ef23abcf61
commit cfd4823b65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,16 +36,15 @@ RSpec.describe Follow do
end end
end end
describe 'recent' do describe '.recent' do
it 'sorts so that more recent follows comes earlier' do let!(:follow_earlier) { Fabricate(:follow) }
follow0 = described_class.create!(account: alice, target_account: bob) let!(:follow_later) { Fabricate(:follow) }
follow1 = described_class.create!(account: bob, target_account: alice)
a = described_class.recent.to_a it 'sorts with most recent follows first' do
results = described_class.recent
expect(a.size).to eq 2 expect(results.size).to eq 2
expect(a[0]).to eq follow1 expect(results).to eq [follow_later, follow_earlier]
expect(a[1]).to eq follow0
end end
end end