Reduce factory creation (132 -> 40) in lib/vacuum/* specs (#32498)
This commit is contained in:
parent
d74c2c583a
commit
0cc21f1ded
6 changed files with 41 additions and 58 deletions
|
@ -14,32 +14,24 @@ RSpec.describe Vacuum::AccessTokensVacuum do
|
|||
let!(:expired_access_grant) { Fabricate(:access_grant, expires_in: 59.minutes.to_i, created_at: 1.hour.ago) }
|
||||
let!(:active_access_grant) { Fabricate(:access_grant) }
|
||||
|
||||
before do
|
||||
it 'deletes revoked/expired access tokens and revoked/expired grants, but preserves active tokens/grants' do
|
||||
subject.perform
|
||||
end
|
||||
|
||||
it 'deletes revoked access tokens' do
|
||||
expect { revoked_access_token.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
expect { revoked_access_token.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
expect { expired_access_token.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
|
||||
it 'deletes expired access tokens' do
|
||||
expect { expired_access_token.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
expect { revoked_access_grant.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
expect { expired_access_grant.reload }
|
||||
.to raise_error ActiveRecord::RecordNotFound
|
||||
|
||||
it 'deletes revoked access grants' do
|
||||
expect { revoked_access_grant.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
expect { active_access_token.reload }
|
||||
.to_not raise_error
|
||||
|
||||
it 'deletes expired access grants' do
|
||||
expect { expired_access_grant.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
it 'does not delete active access tokens' do
|
||||
expect { active_access_token.reload }.to_not raise_error
|
||||
end
|
||||
|
||||
it 'does not delete active access grants' do
|
||||
expect { active_access_grant.reload }.to_not raise_error
|
||||
expect { active_access_grant.reload }
|
||||
.to_not raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue