summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-04-24 15:13:26 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-04-24 15:13:26 +0000
commit0affdb85b1c84d2664da634b5dea86c1be5e8c6a (patch)
treeef98102098908374bb6b5fef3c0358846e592b30 /spec/helpers
parent8e6dabb0118a8245f42974f9e92fe53ccb1c43f2 (diff)
parentee40ec7ddbfb8b1dfdeec615bae34e5e977c5165 (diff)
downloadgitlab-ce-0affdb85b1c84d2664da634b5dea86c1be5e8c6a.tar.gz
Merge branch 'fix/gb/fix-incorrect-commit-status-badge-text' into 'master'
Fix incorrect commit status text on main project page See merge request !10863
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/ci_status_helper_spec.rb47
1 files changed, 38 insertions, 9 deletions
diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb
index c795fe5a2a3..3dc13001056 100644
--- a/spec/helpers/ci_status_helper_spec.rb
+++ b/spec/helpers/ci_status_helper_spec.rb
@@ -6,25 +6,54 @@ describe CiStatusHelper do
let(:success_commit) { double("Ci::Pipeline", status: 'success') }
let(:failed_commit) { double("Ci::Pipeline", status: 'failed') }
- describe 'ci_icon_for_status' do
+ describe '#ci_icon_for_status' do
it 'renders to correct svg on success' do
- expect(helper).to receive(:render).with('shared/icons/icon_status_success.svg', anything)
+ expect(helper).to receive(:render)
+ .with('shared/icons/icon_status_success.svg', anything)
+
helper.ci_icon_for_status(success_commit.status)
end
+
it 'renders the correct svg on failure' do
- expect(helper).to receive(:render).with('shared/icons/icon_status_failed.svg', anything)
+ expect(helper).to receive(:render)
+ .with('shared/icons/icon_status_failed.svg', anything)
+
helper.ci_icon_for_status(failed_commit.status)
end
end
+ describe '#ci_text_for_status' do
+ context 'when status is manual' do
+ it 'changes the status to blocked' do
+ expect(helper.ci_text_for_status('manual'))
+ .to eq 'blocked'
+ end
+ end
+
+ context 'when status is success' do
+ it 'changes the status to passed' do
+ expect(helper.ci_text_for_status('success'))
+ .to eq 'passed'
+ end
+ end
+
+ context 'when status is something else' do
+ it 'returns status unchanged' do
+ expect(helper.ci_text_for_status('some-status'))
+ .to eq 'some-status'
+ end
+ end
+ end
+
describe "#pipeline_status_cache_key" do
+ let(:pipeline_status) do
+ Gitlab::Cache::Ci::ProjectPipelineStatus
+ .new(build(:project), sha: '123abc', status: 'success')
+ end
+
it "builds a cache key for pipeline status" do
- pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new(
- build(:project),
- sha: "123abc",
- status: "success"
- )
- expect(helper.pipeline_status_cache_key(pipeline_status)).to eq("pipeline-status/123abc-success")
+ expect(helper.pipeline_status_cache_key(pipeline_status))
+ .to eq("pipeline-status/123abc-success")
end
end
end