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 13:29:00 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-03 13:29:00 +0300
commit717fdd6d42f119dd1e0f457c40563cc35985fbae (patch)
treecdcb1a8167a809c8c203d50dcff65ef44d0eace2 /spec/models
parentb2acebb4efdf8023f685cfd14489c49e56d126a7 (diff)
Rename Ci::Build commit to pipeline
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/build_spec.rb18
-rw-r--r--spec/models/ci/commit_spec.rb42
-rw-r--r--spec/models/commit_status_spec.rb30
-rw-r--r--spec/models/generic_commit_status_spec.rb2
4 files changed, 46 insertions, 46 deletions
diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb
index 5c6c30c20ea..86d581721b1 100644
--- a/spec/models/build_spec.rb
+++ b/spec/models/build_spec.rb
@@ -3,15 +3,15 @@ require 'spec_helper'
describe Ci::Build, models: true do
let(:project) { create(:project) }
let(:commit) { create(:ci_commit, project: project) }
- let(:build) { create(:ci_build, commit: commit) }
+ let(:build) { create(:ci_build, pipeline: commit) }
it { is_expected.to validate_presence_of :ref }
it { is_expected.to respond_to :trace_html }
describe '#first_pending' do
- let!(:first) { create(:ci_build, commit: commit, status: 'pending', created_at: Date.yesterday) }
- let!(:second) { create(:ci_build, commit: commit, status: 'pending') }
+ let!(:first) { create(:ci_build, pipeline: commit, status: 'pending', created_at: Date.yesterday) }
+ let!(:second) { create(:ci_build, pipeline: commit, status: 'pending') }
subject { Ci::Build.first_pending }
it { is_expected.to be_a(Ci::Build) }
@@ -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, commit: commit, trigger: trigger) }
+ let(:trigger_request) { create(:ci_trigger_request_with_variables, pipeline: commit, trigger: trigger) }
let(:trigger_variables) do
[
{ key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false }
@@ -428,10 +428,10 @@ describe Ci::Build, models: true do
end
describe '#depends_on_builds' do
- let!(:build) { create(:ci_build, commit: commit, name: 'build', stage_idx: 0, stage: 'build') }
- let!(:rspec_test) { create(:ci_build, commit: commit, name: 'rspec', stage_idx: 1, stage: 'test') }
- let!(:rubocop_test) { create(:ci_build, commit: commit, name: 'rubocop', stage_idx: 1, stage: 'test') }
- let!(:staging) { create(:ci_build, commit: commit, name: 'staging', stage_idx: 2, stage: 'deploy') }
+ let!(:build) { create(:ci_build, pipeline: commit, name: 'build', stage_idx: 0, stage: 'build') }
+ let!(:rspec_test) { create(:ci_build, pipeline: commit, name: 'rspec', stage_idx: 1, stage: 'test') }
+ let!(:rubocop_test) { create(:ci_build, pipeline: commit, name: 'rubocop', stage_idx: 1, stage: 'test') }
+ let!(:staging) { create(:ci_build, pipeline: commit, name: 'staging', stage_idx: 2, stage: 'deploy') }
it 'to have no dependents if this is first build' do
expect(build.depends_on_builds).to be_empty
@@ -500,7 +500,7 @@ describe Ci::Build, models: true do
before do
@merge_request = create_mr(build, commit, factory: :merge_request_with_diffs)
commit2 = create(:ci_commit, project: project)
- @build2 = create(:ci_build, commit: commit2)
+ @build2 = create(:ci_build, pipeline: commit2)
commits = [double(id: commit.sha), double(id: commit2.sha)]
allow(@merge_request).to receive(:commits).and_return(commits)
diff --git a/spec/models/ci/commit_spec.rb b/spec/models/ci/commit_spec.rb
index 2c6e6db682f..8426f28d445 100644
--- a/spec/models/ci/commit_spec.rb
+++ b/spec/models/ci/commit_spec.rb
@@ -42,8 +42,8 @@ describe Ci::Pipeline, models: true do
subject { commit.retried }
before do
- @commit1 = FactoryGirl.create :ci_build, commit: commit, name: 'deploy'
- @commit2 = FactoryGirl.create :ci_build, commit: commit, name: 'deploy'
+ @commit1 = FactoryGirl.create :ci_build, pipeline: commit, name: 'deploy'
+ @commit2 = FactoryGirl.create :ci_build, pipeline: commit, name: 'deploy'
end
it 'returns old builds' do
@@ -264,14 +264,14 @@ describe Ci::Pipeline, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
it "returns finished_at of latest build" do
- build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60
- FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120
+ build = FactoryGirl.create :ci_build, pipeline: commit, finished_at: Time.now - 60
+ FactoryGirl.create :ci_build, pipeline: commit, finished_at: Time.now - 120
expect(commit.finished_at.to_i).to eq(build.finished_at.to_i)
end
it "returns nil if there is no finished build" do
- FactoryGirl.create :ci_not_started_build, commit: commit
+ FactoryGirl.create :ci_not_started_build, pipeline: commit
expect(commit.finished_at).to be_nil
end
@@ -282,27 +282,27 @@ describe Ci::Pipeline, models: true do
let(:commit) { FactoryGirl.create :ci_commit, project: project }
it "calculates average when there are two builds with coverage" do
- FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
- FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
+ FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
+ FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there are two builds with coverage and one with nil" do
- FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
- FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
- FactoryGirl.create :ci_build, commit: commit
+ FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
+ FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
+ FactoryGirl.create :ci_build, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there are two builds with coverage and one is retried" do
- FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
- FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, commit: commit
- FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
+ FactoryGirl.create :ci_build, name: "rspec", coverage: 30, pipeline: commit
+ FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, pipeline: commit
+ FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, pipeline: commit
expect(commit.coverage).to eq("35.00")
end
it "calculates average when there is one build without coverage" do
- FactoryGirl.create :ci_build, commit: commit
+ FactoryGirl.create :ci_build, pipeline: commit
expect(commit.coverage).to be_nil
end
end
@@ -312,7 +312,7 @@ describe Ci::Pipeline, models: true do
context 'no failed builds' do
before do
- FactoryGirl.create :ci_build, name: "rspec", commit: commit, status: 'success'
+ FactoryGirl.create :ci_build, name: "rspec", pipeline: commit, status: 'success'
end
it 'be not retryable' do
@@ -322,8 +322,8 @@ describe Ci::Pipeline, models: true do
context 'with failed builds' do
before do
- FactoryGirl.create :ci_build, name: "rspec", commit: commit, status: 'running'
- FactoryGirl.create :ci_build, name: "rubocop", commit: commit, status: 'failed'
+ FactoryGirl.create :ci_build, name: "rspec", pipeline: commit, status: 'running'
+ FactoryGirl.create :ci_build, name: "rubocop", pipeline: commit, status: 'failed'
end
it 'be retryable' do
@@ -337,8 +337,8 @@ describe Ci::Pipeline, models: true do
subject { CommitStatus.where(commit: [commit, commit2]).stages }
before do
- FactoryGirl.create :ci_build, commit: commit2, stage: 'test', stage_idx: 1
- FactoryGirl.create :ci_build, commit: commit, stage: 'build', stage_idx: 0
+ FactoryGirl.create :ci_build, pipeline: commit2, stage: 'test', stage_idx: 1
+ FactoryGirl.create :ci_build, pipeline: commit, stage: 'build', stage_idx: 0
end
it 'return all stages' do
@@ -353,7 +353,7 @@ describe Ci::Pipeline, models: true do
end
context 'dependent objects' do
- let(:commit_status) { build :commit_status, commit: commit }
+ let(:commit_status) { build :commit_status, pipeline: commit }
it 'execute update_state after saving dependent object' do
expect(commit).to receive(:update_state).and_return(true)
@@ -363,7 +363,7 @@ describe Ci::Pipeline, models: true do
context 'update state' do
let(:current) { Time.now.change(usec: 0) }
- let(:build) { FactoryGirl.create :ci_build, :success, commit: commit, started_at: current - 120, finished_at: current - 60 }
+ let(:build) { FactoryGirl.create :ci_build, :success, pipeline: commit, started_at: current - 120, finished_at: current - 60 }
before do
build
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 434e58cfd06..b435d835722 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe CommitStatus, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
- let(:commit_status) { FactoryGirl.create :commit_status, commit: commit }
+ let(:commit_status) { FactoryGirl.create :commit_status, pipeline: commit }
it { is_expected.to belong_to(:commit) }
it { is_expected.to belong_to(:user) }
@@ -121,11 +121,11 @@ describe CommitStatus, models: true do
subject { CommitStatus.latest.order(:id) }
before do
- @commit1 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'running'
- @commit2 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'cc', status: 'pending'
- @commit3 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'cc', status: 'success'
- @commit4 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'bb', status: 'success'
- @commit5 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'success'
+ @commit1 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'running'
+ @commit2 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'cc', status: 'pending'
+ @commit3 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'cc', status: 'success'
+ @commit4 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'bb', status: 'success'
+ @commit5 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'success'
end
it 'return unique statuses' do
@@ -137,11 +137,11 @@ describe CommitStatus, models: true do
subject { CommitStatus.running_or_pending.order(:id) }
before do
- @commit1 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: 'bb', status: 'running'
- @commit2 = FactoryGirl.create :commit_status, commit: commit, name: 'cc', ref: 'cc', status: 'pending'
- @commit3 = FactoryGirl.create :commit_status, commit: commit, name: 'aa', ref: nil, status: 'success'
- @commit4 = FactoryGirl.create :commit_status, commit: commit, name: 'dd', ref: nil, status: 'failed'
- @commit5 = FactoryGirl.create :commit_status, commit: commit, name: 'ee', ref: nil, status: 'canceled'
+ @commit1 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: 'bb', status: 'running'
+ @commit2 = FactoryGirl.create :commit_status, pipeline: commit, name: 'cc', ref: 'cc', status: 'pending'
+ @commit3 = FactoryGirl.create :commit_status, pipeline: commit, name: 'aa', ref: nil, status: 'success'
+ @commit4 = FactoryGirl.create :commit_status, pipeline: commit, name: 'dd', ref: nil, status: 'failed'
+ @commit5 = FactoryGirl.create :commit_status, pipeline: commit, name: 'ee', ref: nil, status: 'canceled'
end
it 'return statuses that are running or pending' do
@@ -172,10 +172,10 @@ describe CommitStatus, models: true do
describe '#stages' do
before do
- FactoryGirl.create :commit_status, commit: commit, stage: 'build', stage_idx: 0, status: 'success'
- FactoryGirl.create :commit_status, commit: commit, stage: 'build', stage_idx: 0, status: 'failed'
- FactoryGirl.create :commit_status, commit: commit, stage: 'deploy', stage_idx: 2, status: 'running'
- FactoryGirl.create :commit_status, commit: commit, stage: 'test', stage_idx: 1, status: 'success'
+ FactoryGirl.create :commit_status, pipeline: commit, stage: 'build', stage_idx: 0, status: 'success'
+ FactoryGirl.create :commit_status, pipeline: commit, stage: 'build', stage_idx: 0, status: 'failed'
+ FactoryGirl.create :commit_status, pipeline: commit, stage: 'deploy', stage_idx: 2, status: 'running'
+ FactoryGirl.create :commit_status, pipeline: commit, stage: 'test', stage_idx: 1, status: 'success'
end
context 'stages list' do
diff --git a/spec/models/generic_commit_status_spec.rb b/spec/models/generic_commit_status_spec.rb
index d0e02618b6b..d2cd37c9b4f 100644
--- a/spec/models/generic_commit_status_spec.rb
+++ b/spec/models/generic_commit_status_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe GenericCommitStatus, models: true do
let(:commit) { FactoryGirl.create :ci_commit }
- let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, commit: commit }
+ let(:generic_commit_status) { FactoryGirl.create :generic_commit_status, pipeline: commit }
describe :context do
subject { generic_commit_status.context }