Browse Source

Apply Rubocop Rails/WhereNot (#23448)

* Apply Rubocop Rails/WhereNot

* Update spec for where.not
closed-social-glitch-2
Nick Schonning 1 year ago
committed by GitHub
parent
commit
0592937264
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions
  1. +2
    -2
      app/lib/vacuum/access_tokens_vacuum.rb
  2. +1
    -1
      app/models/session_activation.rb
  3. +2
    -2
      spec/models/session_activation_spec.rb

+ 2
- 2
app/lib/vacuum/access_tokens_vacuum.rb View File

@ -9,10 +9,10 @@ class Vacuum::AccessTokensVacuum
private
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
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

+ 1
- 1
app/models/session_activation.rb View File

@ -59,7 +59,7 @@ class SessionActivation < ApplicationRecord
end
def exclusive(id)
where('session_id != ?', id).destroy_all
where.not(session_id: id).destroy_all
end
end

+ 2
- 2
spec/models/session_activation_spec.rb View File

@ -118,8 +118,8 @@ RSpec.describe SessionActivation, type: :model do
let(:id) { '1' }
it 'calls where.destroy_all' do
expect(described_class).to receive_message_chain(:where, :destroy_all)
.with('session_id != ?', id).with(no_args)
expect(described_class).to receive_message_chain(:where, :not, :destroy_all)
.with(session_id: id).with(no_args)
described_class.exclusive(id)
end

Loading…
Cancel
Save