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:
authorLin Jen-Shin <godfat@godfat.org>2016-11-03 18:39:37 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-11-03 18:39:37 +0300
commit1ae557c106e94c20742d0788dc7eb604603faa08 (patch)
tree5a3fb7c52bf5d733fd3e69765098a040884a48cc /spec/models/commit_spec.rb
parentee4c8b75de6b04a8c2ed755b1b409dab9f0536c5 (diff)
Merge status_for and status, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7034#note_17742297
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb70
1 files changed, 36 insertions, 34 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 468e198e9ea..203fb6596a6 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -210,49 +210,51 @@ eos
end
describe '#status' do
- shared_examples 'giving the status from pipeline' do
- it do
- expect(commit.status).to eq(Ci::Pipeline.status)
+ context 'without arguments for compound status' do
+ shared_examples 'giving the status from pipeline' do
+ it do
+ expect(commit.status).to eq(Ci::Pipeline.status)
+ end
end
- end
- context 'with pipelines' do
- let!(:pipeline) do
- create(:ci_empty_pipeline, project: project, sha: commit.sha)
- end
+ context 'with pipelines' do
+ let!(:pipeline) do
+ create(:ci_empty_pipeline, project: project, sha: commit.sha)
+ end
- it_behaves_like 'giving the status from pipeline'
- end
+ it_behaves_like 'giving the status from pipeline'
+ end
- context 'without pipelines' do
- it_behaves_like 'giving the status from pipeline'
+ context 'without pipelines' do
+ it_behaves_like 'giving the status from pipeline'
+ end
end
- end
- describe '#status_for' do
- let!(:pipeline_from_master) do
- create(:ci_empty_pipeline,
- project: project,
- sha: commit.sha,
- ref: 'master',
- status: 'failed')
- end
+ context 'when a particular ref is specified' do
+ let!(:pipeline_from_master) do
+ create(:ci_empty_pipeline,
+ project: project,
+ sha: commit.sha,
+ ref: 'master',
+ status: 'failed')
+ end
- let!(:pipeline_from_fix) do
- create(:ci_empty_pipeline,
- project: project,
- sha: commit.sha,
- ref: 'fix',
- status: 'success')
- end
+ let!(:pipeline_from_fix) do
+ create(:ci_empty_pipeline,
+ project: project,
+ sha: commit.sha,
+ ref: 'fix',
+ status: 'success')
+ end
- it 'gives pipelines from a particular branch' do
- expect(commit.status_for('master')).to eq(pipeline_from_master.status)
- expect(commit.status_for('fix')).to eq(pipeline_from_fix.status)
- end
+ it 'gives pipelines from a particular branch' do
+ expect(commit.status('master')).to eq(pipeline_from_master.status)
+ expect(commit.status('fix')).to eq(pipeline_from_fix.status)
+ end
- it 'gives compound status if ref is nil' do
- expect(commit.status_for(nil)).to eq(commit.status)
+ it 'gives compound status if ref is nil' do
+ expect(commit.status(nil)).to eq(commit.status)
+ end
end
end