summaryrefslogtreecommitdiff
path: root/spec/serializers/pipeline_entity_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers/pipeline_entity_spec.rb')
-rw-r--r--spec/serializers/pipeline_entity_spec.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb
index 774486dcb6d..ca0d8ab42e1 100644
--- a/spec/serializers/pipeline_entity_spec.rb
+++ b/spec/serializers/pipeline_entity_spec.rb
@@ -1,8 +1,8 @@
-require 'spec_helper'
+require "spec_helper"
describe PipelineEntity do
set(:user) { create(:user) }
- let(:request) { double('request') }
+ let(:request) { double("request") }
before do
stub_not_protect_default_branch
@@ -14,41 +14,41 @@ describe PipelineEntity do
described_class.represent(pipeline, request: request)
end
- describe '#as_json' do
+ describe "#as_json" do
subject { entity.as_json }
- context 'when pipeline is empty' do
+ context "when pipeline is empty" do
let(:pipeline) { create(:ci_empty_pipeline) }
- it 'contains required fields' do
+ it "contains required fields" do
expect(subject).to include :id, :user, :path, :coverage, :source
expect(subject).to include :ref, :commit
expect(subject).to include :updated_at, :created_at
end
- it 'excludes coverage data when disabled' do
+ it "excludes coverage data when disabled" do
entity = described_class
.represent(pipeline, request: request, disable_coverage: true)
expect(entity.as_json).not_to include(:coverage)
end
- it 'contains details' do
+ it "contains details" do
expect(subject).to include :details
expect(subject[:details])
.to include :duration, :finished_at
expect(subject[:details][:status]).to include :icon, :favicon, :text, :label, :tooltip
end
- it 'contains flags' do
+ it "contains flags" do
expect(subject).to include :flags
expect(subject[:flags])
.to include :latest, :stuck, :auto_devops,
- :yaml_errors, :retryable, :cancelable, :merge_request
+ :yaml_errors, :retryable, :cancelable, :merge_request
end
end
- context 'when pipeline is retryable' do
+ context "when pipeline is retryable" do
let(:project) { create(:project) }
let(:pipeline) do
@@ -59,24 +59,24 @@ describe PipelineEntity do
create(:ci_build, :failed, pipeline: pipeline)
end
- context 'user has ability to retry pipeline' do
+ context "user has ability to retry pipeline" do
before do
project.add_developer(user)
end
- it 'contains retry path' do
+ it "contains retry path" do
expect(subject[:retry_path]).to be_present
end
end
- context 'user does not have ability to retry pipeline' do
- it 'does not contain retry path' do
+ context "user does not have ability to retry pipeline" do
+ it "does not contain retry path" do
expect(subject).not_to have_key(:retry_path)
end
end
end
- context 'when pipeline is cancelable' do
+ context "when pipeline is cancelable" do
let(:project) { create(:project) }
let(:pipeline) do
@@ -87,45 +87,45 @@ describe PipelineEntity do
create(:ci_build, :pending, pipeline: pipeline)
end
- context 'user has ability to cancel pipeline' do
+ context "user has ability to cancel pipeline" do
before do
project.add_developer(user)
end
- it 'contains cancel path' do
+ it "contains cancel path" do
expect(subject[:cancel_path]).to be_present
end
end
- context 'user does not have ability to cancel pipeline' do
- it 'does not contain cancel path' do
+ context "user does not have ability to cancel pipeline" do
+ it "does not contain cancel path" do
expect(subject).not_to have_key(:cancel_path)
end
end
end
- context 'when pipeline ref is empty' do
+ context "when pipeline ref is empty" do
let(:pipeline) { create(:ci_empty_pipeline) }
before do
allow(pipeline).to receive(:ref).and_return(nil)
end
- it 'does not generate branch path' do
+ it "does not generate branch path" do
expect(subject[:ref][:path]).to be_nil
end
end
- context 'when pipeline has a failure reason set' do
+ context "when pipeline has a failure reason set" do
let(:pipeline) { create(:ci_empty_pipeline) }
before do
pipeline.drop!(:config_error)
end
- it 'has a correct failure reason' do
+ it "has a correct failure reason" do
expect(subject[:failure_reason])
- .to eq 'CI/CD YAML configuration error!'
+ .to eq "CI/CD YAML configuration error!"
end
end
end