FIX: We need to skip users with associated reviewables when auto-approving (#9080)

* FIX: We need to skip users with associated reviewables when auto-approving them

* Update spec/initializers/track_setting_changes_spec.rb

* Update spec/initializers/track_setting_changes_spec.rb

Co-authored-by: Robin Ward <robin.ward@gmail.com>
This commit is contained in:
Roman Rizzi
2020-03-02 16:33:52 -03:00
committed by GitHub
parent f44ad91a52
commit 537f87562e
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Setting changes' do
describe '#must_approve_users' do
before { SiteSetting.must_approve_users = false }
it 'does not approve a user with associated reviewables' do
user_pending_approval = Fabricate(:reviewable_user).target
SiteSetting.must_approve_users = true
expect(user_pending_approval.reload.approved?).to eq(false)
end
it 'approves a user with no associated reviewables' do
non_approved_user = Fabricate(:user, approved: false)
SiteSetting.must_approve_users = true
expect(non_approved_user.reload.approved?).to eq(true)
end
end
end