Skip to content

Commit

Permalink
Fix RSpec/LetSetup cop in models/account_status_cleanup_policy (mas…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored and vmstan committed Jan 5, 2024
1 parent 705de98 commit 9dcc3db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ Metrics/PerceivedComplexity:
RSpec/ExampleLength:
Max: 22

RSpec/LetSetup:
Exclude:
- 'spec/models/account_statuses_cleanup_policy_spec.rb'

RSpec/MultipleExpectations:
Max: 8

Expand Down
24 changes: 14 additions & 10 deletions spec/models/account_statuses_cleanup_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,17 @@
describe '#compute_cutoff_id' do
subject { account_statuses_cleanup_policy.compute_cutoff_id }

let!(:unrelated_status) { Fabricate(:status, created_at: 3.years.ago) }
let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }

before { Fabricate(:status, created_at: 3.years.ago) }

context 'when the account has posted multiple toots' do
let!(:very_old_status) { Fabricate(:status, created_at: 3.years.ago, account: account) }
let!(:old_status) { Fabricate(:status, created_at: 3.weeks.ago, account: account) }
let!(:recent_status) { Fabricate(:status, created_at: 2.days.ago, account: account) }
let!(:old_status) { Fabricate(:status, created_at: 3.weeks.ago, account: account) }

before do
Fabricate(:status, created_at: 3.years.ago, account: account)
Fabricate(:status, created_at: 2.days.ago, account: account)
end

it 'returns the most recent id that is still below policy age' do
expect(subject).to eq old_status.id
Expand Down Expand Up @@ -270,16 +274,16 @@
let!(:faved_secondary) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:reblogged_primary) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:reblogged_secondary) { Fabricate(:status, created_at: 1.year.ago, account: account) }
let!(:recent_status) { Fabricate(:status, created_at: 2.days.ago, account: account) }

let!(:media_attachment) { Fabricate(:media_attachment, account: account, status: status_with_media) }
let!(:status_pin) { Fabricate(:status_pin, account: account, status: pinned_status) }
let!(:favourite) { Fabricate(:favourite, account: account, status: self_faved) }
let!(:bookmark) { Fabricate(:bookmark, account: account, status: self_bookmarked) }
let!(:recent_status) { Fabricate(:status, created_at: 2.days.ago, account: account) }

let(:account_statuses_cleanup_policy) { Fabricate(:account_statuses_cleanup_policy, account: account) }

before do
Fabricate(:media_attachment, account: account, status: status_with_media)
Fabricate(:status_pin, account: account, status: pinned_status)
Fabricate(:favourite, account: account, status: self_faved)
Fabricate(:bookmark, account: account, status: self_bookmarked)

faved_primary.status_stat.update(favourites_count: 4)
faved_secondary.status_stat.update(favourites_count: 5)
reblogged_primary.status_stat.update(reblogs_count: 4)
Expand Down

0 comments on commit 9dcc3db

Please sign in to comment.