mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-11 13:46:11 +10:00
Rename specific_for to available_for:
Feedback from: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12413950
This commit is contained in:
@@ -7,7 +7,7 @@ class Projects::RunnersController < Projects::ApplicationController
|
||||
def index
|
||||
@runners = project.runners.ordered
|
||||
@specific_runners = current_user.ci_authorized_runners.
|
||||
specific_for(project).ordered.page(params[:page]).per(20)
|
||||
available_for(project).ordered.page(params[:page]).per(20)
|
||||
@shared_runners = Ci::Runner.shared.active
|
||||
@shared_runners_count = @shared_runners.count(:all)
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ module Ci
|
||||
.where("ci_runner_projects.gl_project_id = :project_id OR ci_runners.is_shared = true", project_id: project_id)
|
||||
end
|
||||
|
||||
scope :specific_for, ->(project) do
|
||||
scope :available_for, ->(project) do
|
||||
# TODO: That `to_sql` is needed to workaround a weird Rails bug.
|
||||
# Without that, placeholders would miss one and couldn't match.
|
||||
where(locked: false).
|
||||
|
||||
@@ -259,7 +259,7 @@ describe Ci::Runner, models: true do
|
||||
end
|
||||
end
|
||||
|
||||
describe '.specific_for' do
|
||||
describe '.available_for' do
|
||||
let(:runner) { create(:ci_runner) }
|
||||
let(:project) { create(:project) }
|
||||
let(:another_project) { create(:project) }
|
||||
@@ -274,13 +274,13 @@ describe Ci::Runner, models: true do
|
||||
end
|
||||
|
||||
context 'should not give owned runner' do
|
||||
subject { Ci::Runner.specific_for(project) }
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'should not give shared runner' do
|
||||
subject { Ci::Runner.specific_for(another_project) }
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
@@ -288,13 +288,13 @@ describe Ci::Runner, models: true do
|
||||
|
||||
context 'with unlocked runner' do
|
||||
context 'should not give owned runner' do
|
||||
subject { Ci::Runner.specific_for(project) }
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'should give a specific runner' do
|
||||
subject { Ci::Runner.specific_for(another_project) }
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
|
||||
it { is_expected.to contain_exactly(runner) }
|
||||
end
|
||||
@@ -306,13 +306,13 @@ describe Ci::Runner, models: true do
|
||||
end
|
||||
|
||||
context 'should not give owned runner' do
|
||||
subject { Ci::Runner.specific_for(project) }
|
||||
subject { Ci::Runner.available_for(project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
context 'should not give a locked runner' do
|
||||
subject { Ci::Runner.specific_for(another_project) }
|
||||
subject { Ci::Runner.available_for(another_project) }
|
||||
|
||||
it { is_expected.to be_empty }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user