summaryrefslogtreecommitdiff
path: root/spec/serializers/build_serializer_spec.rb
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-11 23:30:25 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-23 17:11:49 +0900
commit08a0bc5397b6f41deef5d2e492c6cf101db741ae (patch)
tree2000f8aba3fdd356a6b9ffa6d048895814330115 /spec/serializers/build_serializer_spec.rb
parent448c695c2afeb9b69fa274244a7ac6b85ef50f00 (diff)
downloadgitlab-ce-08a0bc5397b6f41deef5d2e492c6cf101db741ae.tar.gz
Add more specs
Diffstat (limited to 'spec/serializers/build_serializer_spec.rb')
-rw-r--r--spec/serializers/build_serializer_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/serializers/build_serializer_spec.rb b/spec/serializers/build_serializer_spec.rb
index a8069004e7b..5a55d9d7dc1 100644
--- a/spec/serializers/build_serializer_spec.rb
+++ b/spec/serializers/build_serializer_spec.rb
@@ -10,7 +10,21 @@ describe BuildSerializer do
subject { serializer.represent(resource) }
describe '#represent' do
- # TODO:
+ context 'when a single object is being serialized' do
+ let(:resource) { create(:ci_build) }
+
+ it 'serializers the pipeline object' do
+ expect(subject[:id]).to eq resource.id
+ end
+ end
+
+ context 'when multiple objects are being serialized' do
+ let(:resource) { create_list(:ci_build, 2) }
+
+ it 'serializers the array of pipelines' do
+ expect(subject).not_to be_empty
+ end
+ end
end
describe '#represent_status' do
@@ -23,6 +37,9 @@ describe BuildSerializer do
subject { serializer.represent_status(resource) }
it 'serializes only status' do
+ expect(subject[:text]).to eq(status.text)
+ expect(subject[:label]).to eq(status.label)
+ expect(subject[:icon]).to eq(status.icon)
expect(subject[:favicon]).to eq(status.favicon)
end
end