|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
| 3 | +# rubocop:disable Metrics/BlockLength |
3 | 4 | describe Config do |
4 | | - it 'help returns help' do |
5 | | - expect(Config.help).to start_with('Alma User Load Usage:') |
| 5 | + describe '.help' do |
| 6 | + it 'returns help' do |
| 7 | + expect(Config.help).to start_with('Alma User Load Usage:') |
| 8 | + end |
6 | 9 | end |
7 | 10 |
|
8 | | - it 'config setting for change log days is 7' do |
9 | | - expect(Config.setting('change_log_days')).to eq(7) |
| 11 | + describe '.setting' do |
| 12 | + it 'returns change log days as 7' do |
| 13 | + expect(Config.setting('change_log_days')).to eq(7) |
| 14 | + end |
10 | 15 | end |
11 | 16 | end |
| 17 | + |
| 18 | +describe Config do |
| 19 | + describe '.skip_fte_check?' do |
| 20 | + let(:job_code) { 'TEST_CODE' } |
| 21 | + |
| 22 | + before do |
| 23 | + allow(Config).to receive(:check_ucpath_code).and_return(false) |
| 24 | + end |
| 25 | + |
| 26 | + context 'when job_code is in fte_check_exclusions' do |
| 27 | + before do |
| 28 | + allow(Config).to receive(:check_ucpath_code) |
| 29 | + .with('fte_check_exclusions', job_code) |
| 30 | + .and_return(true) |
| 31 | + end |
| 32 | + |
| 33 | + it 'returns true' do |
| 34 | + expect(Config.skip_fte_check?(job_code)).to be(true) |
| 35 | + end |
| 36 | + end |
| 37 | + |
| 38 | + context 'when job_code is in emeritus_job_code' do |
| 39 | + before do |
| 40 | + allow(Config).to receive(:check_ucpath_code) |
| 41 | + .with('emeritus_job_code', job_code) |
| 42 | + .and_return(true) |
| 43 | + end |
| 44 | + |
| 45 | + it 'returns true' do |
| 46 | + expect(Config.skip_fte_check?(job_code)).to be(true) |
| 47 | + end |
| 48 | + end |
| 49 | + |
| 50 | + context 'when job_code is in neither list' do |
| 51 | + it 'returns false' do |
| 52 | + expect(Config.skip_fte_check?(job_code)).to be(false) |
| 53 | + end |
| 54 | + end |
| 55 | + end |
| 56 | +end |
| 57 | + |
| 58 | +describe Config do |
| 59 | + describe '.skip_fte_check? (with real config values)' do |
| 60 | + it 'returns true for a job code in fte_check_exclusions' do |
| 61 | + expect(Config.skip_fte_check?('CWR016')).to be(true) |
| 62 | + end |
| 63 | + |
| 64 | + it 'returns true for a job code in emeritus_job_code' do |
| 65 | + expect(Config.skip_fte_check?('009902')).to be(true) |
| 66 | + end |
| 67 | + |
| 68 | + it 'returns false for a job code not in either list' do |
| 69 | + expect(Config.skip_fte_check?('TOTALLY_FAKE_CODE')).to be(false) |
| 70 | + end |
| 71 | + end |
| 72 | +end |
| 73 | +# rubocop:enable Metrics/BlockLength |
0 commit comments