Commit 0d9eb3ba authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'remove_redundant_unscope' into 'master'

Remove redundant unscope from assocation

See merge request gitlab-org/gitlab!68131
parents 38aaf48f 3743a21d
...@@ -49,10 +49,7 @@ class ProjectFeature < ApplicationRecord ...@@ -49,10 +49,7 @@ class ProjectFeature < ApplicationRecord
end end
end end
# Default scopes force us to unscope here since a service may need to check belongs_to :project
# permissions for a project in pending_delete
# http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to
belongs_to :project, -> { unscope(where: :pending_delete) }
validates :project, presence: true validates :project, presence: true
......
...@@ -8,6 +8,8 @@ RSpec.describe ProjectFeature do ...@@ -8,6 +8,8 @@ RSpec.describe ProjectFeature do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
it { is_expected.to belong_to(:project) }
describe 'PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT' do describe 'PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT' do
it 'has higher level than that of PRIVATE_FEATURES_MIN_ACCESS_LEVEL' do it 'has higher level than that of PRIVATE_FEATURES_MIN_ACCESS_LEVEL' do
described_class::PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT.each do |feature, level| described_class::PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT.each do |feature, level|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment