summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-21 14:47:20 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-12-21 14:47:43 +0100
commitd549a9655803a5e8b90849fd4e29a6805719af3e (patch)
tree8ac50e6bfc255d81495dc5373d2cf6124a74d496 /spec
parentc8b16068be28699da42e1d19a02dc913071919ac (diff)
downloadgitlab-ce-d549a9655803a5e8b90849fd4e29a6805719af3e.tar.gz
Add missing specs for new pipeline related entities
[ci skip]
Diffstat (limited to 'spec')
-rw-r--r--spec/serializers/pipeline_action_entity_spec.rb21
-rw-r--r--spec/serializers/pipeline_artifact_entity_spec.rb22
-rw-r--r--spec/serializers/status_entity_spec.rb11
3 files changed, 49 insertions, 5 deletions
diff --git a/spec/serializers/pipeline_action_entity_spec.rb b/spec/serializers/pipeline_action_entity_spec.rb
new file mode 100644
index 00000000000..77fd7d9936f
--- /dev/null
+++ b/spec/serializers/pipeline_action_entity_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe PipelineActionEntity do
+ let(:build) { create(:ci_build, name: 'test_build') }
+
+ let(:entity) do
+ described_class.new(build, request: double)
+ end
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it 'contains humanized build name' do
+ expect(subject[:name]).to eq 'Test build'
+ end
+
+ it 'contains path to the action play' do
+ expect(subject[:path]).to include "builds/#{build.id}/play"
+ end
+ end
+end
diff --git a/spec/serializers/pipeline_artifact_entity_spec.rb b/spec/serializers/pipeline_artifact_entity_spec.rb
new file mode 100644
index 00000000000..df8ae6d32ae
--- /dev/null
+++ b/spec/serializers/pipeline_artifact_entity_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe PipelineArtifactEntity do
+ let(:build) { create(:ci_build, name: 'test:build') }
+
+ let(:entity) do
+ described_class.new(build, request: double)
+ end
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it 'contains build name' do
+ expect(subject[:name]).to eq 'test:build'
+ end
+
+ it 'contains path to the artifacts' do
+ expect(subject[:path])
+ .to include "builds/#{build.id}/artifacts/download"
+ end
+ end
+end
diff --git a/spec/serializers/status_entity_spec.rb b/spec/serializers/status_entity_spec.rb
index c3da61321de..89428b4216e 100644
--- a/spec/serializers/status_entity_spec.rb
+++ b/spec/serializers/status_entity_spec.rb
@@ -12,11 +12,12 @@ describe StatusEntity do
allow(status).to receive(:details_path).and_return('some/path')
end
- subject { entity.as_json }
+ describe '#as_json' do
+ subject { entity.as_json }
- it 'contains status details' do
- expect(subject).to include :text, :icon, :label
- expect(subject).to include :has_details
- expect(subject).to include :details_path
+ it 'contains status details' do
+ expect(subject).to include :text, :icon, :label, :group
+ expect(subject).to include :has_details, :details_path
+ end
end
end