mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 05:58:07 +01:00
Use context
for repeated scenarios in AccountStatusCleanupPolicy
spec (#32489)
This commit is contained in:
parent
fbe55a4545
commit
ff1247ad16
1 changed files with 42 additions and 40 deletions
|
@ -16,6 +16,8 @@ RSpec.describe AccountStatusesCleanupPolicy do
|
||||||
|
|
||||||
describe 'save hooks' do
|
describe 'save hooks' do
|
||||||
context 'when widening a policy' do
|
context 'when widening a policy' do
|
||||||
|
subject { account_statuses_cleanup_policy.last_inspected }
|
||||||
|
|
||||||
let!(:account_statuses_cleanup_policy) do
|
let!(:account_statuses_cleanup_policy) do
|
||||||
Fabricate(:account_statuses_cleanup_policy,
|
Fabricate(:account_statuses_cleanup_policy,
|
||||||
account: account,
|
account: account,
|
||||||
|
@ -33,64 +35,64 @@ RSpec.describe AccountStatusesCleanupPolicy do
|
||||||
account_statuses_cleanup_policy.record_last_inspected(42)
|
account_statuses_cleanup_policy.record_last_inspected(42)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_direct' do
|
context 'when widened because of keep_direct' do
|
||||||
account_statuses_cleanup_policy.keep_direct = false
|
before { account_statuses_cleanup_policy.update(keep_direct: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_pinned' do
|
context 'when widened because of keep_pinned' do
|
||||||
account_statuses_cleanup_policy.keep_pinned = false
|
before { account_statuses_cleanup_policy.update(keep_pinned: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_polls' do
|
context 'when widened because of keep_polls' do
|
||||||
account_statuses_cleanup_policy.keep_polls = false
|
before { account_statuses_cleanup_policy.update(keep_polls: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_media' do
|
context 'when widened because of keep_media' do
|
||||||
account_statuses_cleanup_policy.keep_media = false
|
before { account_statuses_cleanup_policy.update(keep_media: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_self_fav' do
|
context 'when widened because of keep_self_fav' do
|
||||||
account_statuses_cleanup_policy.keep_self_fav = false
|
before { account_statuses_cleanup_policy.update(keep_self_fav: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of keep_self_bookmark' do
|
context 'when widened because of keep_self_bookmark' do
|
||||||
account_statuses_cleanup_policy.keep_self_bookmark = false
|
before { account_statuses_cleanup_policy.update(keep_self_bookmark: false) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of higher min_favs' do
|
context 'when widened because of higher min_favs' do
|
||||||
account_statuses_cleanup_policy.min_favs = 5
|
before { account_statuses_cleanup_policy.update(min_favs: 5) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of disabled min_favs' do
|
context 'when widened because of disabled min_favs' do
|
||||||
account_statuses_cleanup_policy.min_favs = nil
|
before { account_statuses_cleanup_policy.update(min_favs: nil) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of higher min_reblogs' do
|
context 'when widened because of higher min_reblogs' do
|
||||||
account_statuses_cleanup_policy.min_reblogs = 5
|
before { account_statuses_cleanup_policy.update(min_reblogs: 5) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'invalidates last_inspected when widened because of disable min_reblogs' do
|
context 'when widened because of disable min_reblogs' do
|
||||||
account_statuses_cleanup_policy.min_reblogs = nil
|
before { account_statuses_cleanup_policy.update(min_reblogs: nil) }
|
||||||
account_statuses_cleanup_policy.save
|
|
||||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue