mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 19:04:29 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
47 lines
1.3 KiB
Ruby
47 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.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
|
|
|
|
describe '#reviewable_low_priority_threshold' do
|
|
let(:new_threshold) { 5 }
|
|
|
|
it 'sets the low priority value' do
|
|
medium_threshold = 10
|
|
Reviewable.set_priorities(medium: medium_threshold)
|
|
|
|
expect(Reviewable.min_score_for_priority(:low)).not_to eq(new_threshold)
|
|
|
|
SiteSetting.reviewable_low_priority_threshold = new_threshold
|
|
|
|
expect(Reviewable.min_score_for_priority(:low)).to eq(new_threshold)
|
|
end
|
|
|
|
it "does nothing if the other thresholds were not calculated" do
|
|
Reviewable.set_priorities(medium: 0.0)
|
|
|
|
SiteSetting.reviewable_low_priority_threshold = new_threshold
|
|
|
|
expect(Reviewable.min_score_for_priority(:low)).not_to eq(new_threshold)
|
|
end
|
|
end
|
|
end
|