diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-06 14:14:04 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-06 14:14:04 +0200 |
commit | 93770e1c3c331d7d75bd3637fff585f742c0dd00 (patch) | |
tree | e9f794475c59404151b11ba904b31f8958ae2cc0 | |
parent | 21100f373af6ada4646223230540880cb988b82a (diff) | |
download | gitlab-ce-93770e1c3c331d7d75bd3637fff585f742c0dd00.tar.gz |
Remove redundant serialization entity for the job
-rw-r--r-- | app/serializers/job_entity.rb | 14 | ||||
-rw-r--r-- | app/serializers/job_group_entity.rb | 2 | ||||
-rw-r--r-- | spec/serializers/job_entity_spec.rb | 33 |
3 files changed, 1 insertions, 48 deletions
diff --git a/app/serializers/job_entity.rb b/app/serializers/job_entity.rb deleted file mode 100644 index 3620ee7878b..00000000000 --- a/app/serializers/job_entity.rb +++ /dev/null @@ -1,14 +0,0 @@ -class JobEntity < Grape::Entity - include RequestAwareEntity - - expose :name - expose :detailed_status, as: :status, with: StatusEntity - - private - - alias_method :job, :object - - def detailed_status - job.detailed_status(request.user) - end -end diff --git a/app/serializers/job_group_entity.rb b/app/serializers/job_group_entity.rb index eb2ff76ebb8..a4d3737429c 100644 --- a/app/serializers/job_group_entity.rb +++ b/app/serializers/job_group_entity.rb @@ -4,7 +4,7 @@ class JobGroupEntity < Grape::Entity expose :name expose :size expose :detailed_status, as: :status, with: StatusEntity - expose :jobs, with: JobEntity + expose :jobs, with: BuildEntity private diff --git a/spec/serializers/job_entity_spec.rb b/spec/serializers/job_entity_spec.rb deleted file mode 100644 index 9c6c0e79970..00000000000 --- a/spec/serializers/job_entity_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'spec_helper' - -describe JobEntity do - let(:user) { create(:user) } - let(:request) { double('request') } - - before do - allow(request).to receive(:user).and_return(user) - end - - let(:entity) do - described_class.new(job, request: request) - end - - describe '#as_json' do - let(:job) { create(:ci_build) } - - subject { entity.as_json } - - it 'contains the name and status fields' do - expect(subject).to include :name, :status - end - - it 'contains detailed status' do - expect(subject[:status]).to include :text, :label, :group, :icon - expect(subject[:status][:label]).to eq 'pending' - end - - it 'contains valid name' do - expect(subject[:name]).to eq 'test' - end - end -end |