Apply Rubocop Rails/WhereNot (#23448)
* Apply Rubocop Rails/WhereNot * Update spec for where.notgh/stable
parent
11557d1c5a
commit
0592937264
|
@ -9,10 +9,10 @@ class Vacuum::AccessTokensVacuum
|
||||||
private
|
private
|
||||||
|
|
||||||
def vacuum_revoked_access_tokens!
|
def vacuum_revoked_access_tokens!
|
||||||
Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
|
Doorkeeper::AccessToken.where.not(revoked_at: nil).where('revoked_at < NOW()').delete_all
|
||||||
end
|
end
|
||||||
|
|
||||||
def vacuum_revoked_access_grants!
|
def vacuum_revoked_access_grants!
|
||||||
Doorkeeper::AccessGrant.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all
|
Doorkeeper::AccessGrant.where.not(revoked_at: nil).where('revoked_at < NOW()').delete_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SessionActivation < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def exclusive(id)
|
def exclusive(id)
|
||||||
where('session_id != ?', id).destroy_all
|
where.not(session_id: id).destroy_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,8 @@ RSpec.describe SessionActivation, type: :model do
|
||||||
let(:id) { '1' }
|
let(:id) { '1' }
|
||||||
|
|
||||||
it 'calls where.destroy_all' do
|
it 'calls where.destroy_all' do
|
||||||
expect(described_class).to receive_message_chain(:where, :destroy_all)
|
expect(described_class).to receive_message_chain(:where, :not, :destroy_all)
|
||||||
.with('session_id != ?', id).with(no_args)
|
.with(session_id: id).with(no_args)
|
||||||
|
|
||||||
described_class.exclusive(id)
|
described_class.exclusive(id)
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue