summaryrefslogtreecommitdiff
path: root/spec/finders/ci/runners_finder_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/finders/ci/runners_finder_spec.rb')
-rw-r--r--spec/finders/ci/runners_finder_spec.rb51
1 files changed, 5 insertions, 46 deletions
diff --git a/spec/finders/ci/runners_finder_spec.rb b/spec/finders/ci/runners_finder_spec.rb
index d4795d786bc..4df026f2f5f 100644
--- a/spec/finders/ci/runners_finder_spec.rb
+++ b/spec/finders/ci/runners_finder_spec.rb
@@ -25,10 +25,12 @@ RSpec.describe Ci::RunnersFinder do
end
context 'filter by status' do
- it 'calls the corresponding scope on Ci::Runner' do
- expect(Ci::Runner).to receive(:paused).and_call_original
+ Ci::Runner::AVAILABLE_STATUSES.each do |status|
+ it "calls the corresponding :#{status} scope on Ci::Runner" do
+ expect(Ci::Runner).to receive(status.to_sym).and_call_original
- described_class.new(current_user: admin, params: { status_status: 'paused' }).execute
+ described_class.new(current_user: admin, params: { status_status: status }).execute
+ end
end
end
@@ -70,17 +72,6 @@ RSpec.describe Ci::RunnersFinder do
end
end
- context 'paginate' do
- it 'returns the runners for the specified page' do
- stub_const('Ci::RunnersFinder::NUMBER_OF_RUNNERS_PER_PAGE', 1)
- runner1 = create :ci_runner, created_at: '2018-07-12 07:00'
- runner2 = create :ci_runner, created_at: '2018-07-12 08:00'
-
- expect(described_class.new(current_user: admin, params: { page: 1 }).execute).to eq [runner2]
- expect(described_class.new(current_user: admin, params: { page: 2 }).execute).to eq [runner1]
- end
- end
-
context 'non admin user' do
it 'returns no runners' do
user = create :user
@@ -170,38 +161,6 @@ RSpec.describe Ci::RunnersFinder do
end
end
- context 'paginate' do
- using RSpec::Parameterized::TableSyntax
-
- let(:runners) do
- [[runner_project_7, runner_project_6, runner_project_5],
- [runner_project_4, runner_project_3, runner_project_2],
- [runner_project_1, runner_sub_group_4, runner_sub_group_3],
- [runner_sub_group_2, runner_sub_group_1, runner_group]]
- end
-
- where(:page, :index) do
- 1 | 0
- 2 | 1
- 3 | 2
- 4 | 3
- end
-
- before do
- stub_const('Ci::RunnersFinder::NUMBER_OF_RUNNERS_PER_PAGE', 3)
-
- group.add_owner(user)
- end
-
- with_them do
- let(:params) { { page: page } }
-
- it 'returns the runners for the specified page' do
- expect(subject).to eq(runners[index])
- end
- end
- end
-
context 'filter by search term' do
let(:params) { { search: 'runner_project_search' } }