Override type condition set by rails when scoping User

some tests are order dependant and may fail without that when not all User descendants are loaded at the same time. It does not fail on CI because CI is eager loading all classes.

For a failure, run: bundle exec rspec --order defined ./spec/models/queries/users/filters/name_filter_spec.rb:90 ./spec/models/queries/users/user_query_spec.rb:52
pull/10267/head
Christophe Bliard 3 years ago
parent 6af1d55164
commit c64444dea7
No known key found for this signature in database
GPG Key ID: 2BC07603210C3FA4
  1. 2
      app/models/principals/scopes/user.rb
  2. 3
      spec/models/queries/users/user_query_spec.rb

@ -37,7 +37,7 @@ module Principals::Scopes
def user
# Have to use the User model here so that the scopes defined on User
# are also available after the scope is used.
where(type: [::User.name])
rewhere(type: [::User.name])
end
end
end

@ -27,9 +27,6 @@
#++
require 'spec_helper'
# prevents test failures where the system user
# is mentioned in the User.user scope
require 'system_user'
describe Queries::Users::UserQuery, type: :model do
let(:instance) { described_class.new }

Loading…
Cancel
Save