diff options
author | Matt Jankowski <matt@jankowski.online> | 2024-06-11 02:57:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 06:57:09 +0000 |
commit | cfd4823b65cc91e758ac9d6d97e367b19ca35691 (patch) | |
tree | 6ed23769ace920afb77539346650e10ef99f6ffd /spec | |
parent | ef23abcf617813901e34c5dd9587ef7c88fd754d (diff) |
Use fabricator in follow_spec (#30642)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/follow_spec.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index c7743183cc6..9aa172b2f21 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -36,16 +36,15 @@ RSpec.describe Follow do end end - describe 'recent' do - it 'sorts so that more recent follows comes earlier' do - follow0 = described_class.create!(account: alice, target_account: bob) - follow1 = described_class.create!(account: bob, target_account: alice) + describe '.recent' do + let!(:follow_earlier) { Fabricate(:follow) } + let!(:follow_later) { Fabricate(:follow) } - 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(a[0]).to eq follow1 - expect(a[1]).to eq follow0 + expect(results.size).to eq 2 + expect(results).to eq [follow_later, follow_earlier] end end |