diff options
Diffstat (limited to 'spec/finders/ci/runners_finder_spec.rb')
-rw-r--r-- | spec/finders/ci/runners_finder_spec.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/finders/ci/runners_finder_spec.rb b/spec/finders/ci/runners_finder_spec.rb index 10d3f641e02..7e3c1abd6d1 100644 --- a/spec/finders/ci/runners_finder_spec.rb +++ b/spec/finders/ci/runners_finder_spec.rb @@ -59,6 +59,20 @@ RSpec.describe Ci::RunnersFinder do end end + context 'by active status' do + it 'with active set as false calls the corresponding scope on Ci::Runner with false' do + expect(Ci::Runner).to receive(:active).with(false).and_call_original + + described_class.new(current_user: admin, params: { active: false }).execute + end + + it 'with active set as true calls the corresponding scope on Ci::Runner with true' do + expect(Ci::Runner).to receive(:active).with(true).and_call_original + + described_class.new(current_user: admin, params: { active: true }).execute + end + end + context 'by runner type' do it 'calls the corresponding scope on Ci::Runner' do expect(Ci::Runner).to receive(:project_type).and_call_original @@ -263,7 +277,15 @@ RSpec.describe Ci::RunnersFinder do let(:extra_params) { { search: 'runner_project_search' } } it 'returns correct runner' do - expect(subject).to eq([runner_project_3]) + expect(subject).to match_array([runner_project_3]) + end + end + + context 'by active status' do + let(:extra_params) { { active: false } } + + it 'returns correct runner' do + expect(subject).to match_array([runner_sub_group_1]) end end @@ -271,7 +293,7 @@ RSpec.describe Ci::RunnersFinder do let(:extra_params) { { status_status: 'paused' } } it 'returns correct runner' do - expect(subject).to eq([runner_sub_group_1]) + expect(subject).to match_array([runner_sub_group_1]) end end @@ -279,7 +301,7 @@ RSpec.describe Ci::RunnersFinder do let(:extra_params) { { tag_name: %w[runner_tag] } } it 'returns correct runner' do - expect(subject).to eq([runner_project_5]) + expect(subject).to match_array([runner_project_5]) end end |