diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-03-11 00:16:48 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-03-23 17:11:49 +0900 |
commit | a5b96417f39a5ab8b4d2ddde1fd654937244a73c (patch) | |
tree | d50ded7a51a9ae49c3e71b47cd9f41aa0e2d364a /spec/serializers | |
parent | 3b635002976e1dd45e58271efdb71f7349719d02 (diff) | |
download | gitlab-ce-a5b96417f39a5ab8b4d2ddde1fd654937244a73c.tar.gz |
with_status to represent_status
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/build_serializer_spec.rb | 18 | ||||
-rw-r--r-- | spec/serializers/pipeline_serializer_spec.rb | 16 |
2 files changed, 20 insertions, 14 deletions
diff --git a/spec/serializers/build_serializer_spec.rb b/spec/serializers/build_serializer_spec.rb index e6437538328..a8069004e7b 100644 --- a/spec/serializers/build_serializer_spec.rb +++ b/spec/serializers/build_serializer_spec.rb @@ -10,16 +10,20 @@ describe BuildSerializer do subject { serializer.represent(resource) } describe '#represent' do - context 'when used with status' do - let(:serializer) do - described_class.new(user: user) - .only_status + # TODO: + end + + describe '#represent_status' do + context 'when represents only status' do + let(:status) do + Gitlab::Ci::Status::Success.new(double('object'), double('user')) end - let(:resource) { create(:ci_build) } + let(:resource) { create(:ci_build, status: :success) } + + subject { serializer.represent_status(resource) } it 'serializes only status' do - expect(subject[:details][:status]).not_to be_empty - expect(subject[:details].keys.count).to eq 1 + expect(subject[:favicon]).to eq(status.favicon) end end end diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index 0e043e980ac..a668d9df11a 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -93,17 +93,19 @@ describe PipelineSerializer do end end end + end - context 'when used with status' do - let(:serializer) do - described_class.new(user: user) - .only_status + describe '#represent_status' do + context 'when represents only status' do + let(:status) do + Gitlab::Ci::Status::Success.new(double('object'), double('user')) end - let(:resource) { create(:ci_empty_pipeline) } + let(:resource) { create(:ci_pipeline, status: :success) } + + subject { serializer.represent_status(resource) } it 'serializes only status' do - expect(subject[:details][:status]).not_to be_empty - expect(subject[:details].keys.count).to eq 1 + expect(subject[:favicon]).to eq(status.favicon) end end end |