Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-06-03 15:46:17 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-03 15:46:17 +0300
commit4d5f7aa00827f425dd3d2c3bd5a395c8e948f0ba (patch)
treedc5446ac09424f48cd5b59df67ab7059ac60aa49
parentbcd009e661291554cffe404123de629860519602 (diff)
Fix more places where we should rename ci_commit to pipeline
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/models/ci/trigger_request.rb2
-rw-r--r--spec/models/build_spec.rb2
-rw-r--r--spec/models/ci/pipeline_spec.rb (renamed from spec/models/ci/commit_spec.rb)2
-rw-r--r--spec/models/commit_status_spec.rb10
-rw-r--r--spec/models/merge_request_spec.rb12
-rw-r--r--spec/models/project_spec.rb2
-rw-r--r--spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb4
8 files changed, 18 insertions, 18 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 92fc7c89bd4..9352c6f325a 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -8,7 +8,7 @@ module Ci
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id
has_many :builds, class_name: 'Ci::Build', foreign_key: :commit_id
- has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest'
+ has_many :trigger_requests, dependent: :destroy, class_name: 'Ci::TriggerRequest', foreign_key: :commit_id
validates_presence_of :sha
validates_presence_of :status
diff --git a/app/models/ci/trigger_request.rb b/app/models/ci/trigger_request.rb
index 47632c4b40a..59fc9951d11 100644
--- a/app/models/ci/trigger_request.rb
+++ b/app/models/ci/trigger_request.rb
@@ -3,7 +3,7 @@ module Ci
extend Ci::Model
belongs_to :trigger, class_name: 'Ci::Trigger'
- belongs_to :commit, class_name: 'Ci::Pipeline'
+ belongs_to :commit, class_name: 'Ci::Pipeline', foreign_key: :commit_id
has_many :builds, class_name: 'Ci::Build'
serialize :variables
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 86d581721b1..6c30d85249a 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -219,7 +219,7 @@ describe Ci::Build, models: true do
context 'and trigger variables' do
let(:trigger) { create(:ci_trigger, project: project) }
- let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: commit, trigger: trigger) }
+ let(:trigger_request) { create(:ci_trigger_request_with_variables, commit: commit, trigger: trigger) }
let(:trigger_variables) do
[
{ key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false }
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/pipeline_spec.rb
index 8426f28d445..2f8b1d790a7 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -334,7 +334,7 @@ describe Ci::Pipeline, models: true do
describe '#stages' do
let(:commit2) { FactoryGirl.create :ci_commit, project: project }
- subject { CommitStatus.where(commit: [commit, commit2]).stages }
+ subject { CommitStatus.where(pipeline: [commit, commit2]).stages }
before do
FactoryGirl.create :ci_build, pipeline: commit2, stage: 'test', stage_idx: 1
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index b435d835722..ca630e5bc9c 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -4,15 +4,15 @@ describe CommitStatus, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
let(:commit_status) { FactoryGirl.create :commit_status, pipeline: commit }
- it { is_expected.to belong_to(:commit) }
+ it { is_expected.to belong_to(:pipeline) }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:project) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_inclusion_of(:status).in_array(%w(pending running failed success canceled)) }
- it { is_expected.to delegate_method(:sha).to(:commit) }
- it { is_expected.to delegate_method(:short_sha).to(:commit) }
+ it { is_expected.to delegate_method(:sha).to(:pipeline) }
+ it { is_expected.to delegate_method(:short_sha).to(:pipeline) }
it { is_expected.to respond_to :success? }
it { is_expected.to respond_to :failed? }
@@ -179,7 +179,7 @@ describe CommitStatus, models: true do
end
context 'stages list' do
- subject { CommitStatus.where(commit: commit).stages }
+ subject { CommitStatus.where(pipeline: commit).stages }
it 'return ordered list of stages' do
is_expected.to eq(%w(build test deploy))
@@ -187,7 +187,7 @@ describe CommitStatus, models: true do
end
context 'stages with statuses' do
- subject { CommitStatus.where(commit: commit).stages_status }
+ subject { CommitStatus.where(pipeline: commit).stages_status }
it 'return list of stages with statuses' do
is_expected.to eq({
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 348f2e2f493..21d7a8d8364 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -390,19 +390,19 @@ describe MergeRequest, models: true do
subject { create :merge_request, :simple }
end
- describe '#ci_commit' do
+ describe '#pipeline' do
describe 'when the source project exists' do
it 'returns the latest commit' do
- commit = double(:commit, id: '123abc')
- ci_commit = double(:ci_commit, ref: 'master')
+ commit = double(:commit, id: '123abc')
+ pipeline = double(:ci_commit, ref: 'master')
allow(subject).to receive(:last_commit).and_return(commit)
- expect(subject.source_project).to receive(:ci_commit).
+ expect(subject.source_project).to receive(:pipeline).
with('123abc', 'master').
- and_return(ci_commit)
+ and_return(pipeline)
- expect(subject.pipeline).to eq(ci_commit)
+ expect(subject.pipeline).to eq(pipeline)
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 44debdbdc1c..1135d7b6099 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -22,7 +22,7 @@ describe Project, models: true do
it { is_expected.to have_one(:pushover_service).dependent(:destroy) }
it { is_expected.to have_one(:asana_service).dependent(:destroy) }
it { is_expected.to have_many(:commit_statuses) }
- it { is_expected.to have_many(:ci_commits) }
+ it { is_expected.to have_many(:pipelines) }
it { is_expected.to have_many(:builds) }
it { is_expected.to have_many(:runner_projects) }
it { is_expected.to have_many(:runners) }
diff --git a/spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb b/spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
index 7f8ea8d7c25..d050f4cd95c 100644
--- a/spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
+++ b/spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
@@ -110,8 +110,8 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
context 'properly handles multiple stages' do
let(:ref) { mr_merge_if_green_enabled.source_branch }
- let(:build) { create(:ci_build, commit: ci_commit, ref: ref, name: 'build', stage: 'build') }
- let(:test) { create(:ci_build, commit: ci_commit, ref: ref, name: 'test', stage: 'test') }
+ let(:build) { create(:ci_build, pipeline: ci_commit, ref: ref, name: 'build', stage: 'build') }
+ let(:test) { create(:ci_build, pipeline: ci_commit, ref: ref, name: 'test', stage: 'test') }
before do
# This behavior of MergeRequest: we instantiate a new object