diff options
Diffstat (limited to 'spec/helpers/application_settings_helper_spec.rb')
-rw-r--r-- | spec/helpers/application_settings_helper_spec.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb index 90bfb2e72e6..6d51d85fd64 100644 --- a/spec/helpers/application_settings_helper_spec.rb +++ b/spec/helpers/application_settings_helper_spec.rb @@ -238,7 +238,7 @@ RSpec.describe ApplicationSettingsHelper do expect(helper.kroki_available_formats).to eq([ { name: 'kroki_formats_blockdiag', - label: 'BlockDiag (includes BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag and RackDiag)', + label: 'BlockDiag (includes BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, and RackDiag)', value: true }, { @@ -254,4 +254,34 @@ RSpec.describe ApplicationSettingsHelper do ]) end end + + describe '.pending_user_count' do + let(:user_cap) { 200 } + + before do + stub_application_setting(new_user_signups_cap: user_cap) + end + + subject(:pending_user_count) { helper.pending_user_count } + + context 'when new_user_signups_cap is present' do + it 'returns the number of blocked pending users' do + create(:user, state: :blocked_pending_approval) + + expect(pending_user_count).to eq 1 + end + end + + context 'when the new_user_signups_cap is not present' do + let(:user_cap) { nil } + + it { is_expected.to eq 0 } + + it 'does not query users unnecessarily' do + expect(User).not_to receive(:blocked_pending_approval) + + pending_user_count + end + end + end end |