Commit cbd6ca69 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename specific_for to available_for:

Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4093#note_12413950
parent 53121601
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment