diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-29 10:58:20 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-31 22:56:18 +0300 |
commit | 8a9a62e3294d92f4e70be6f427c17241a2b7a232 (patch) | |
tree | 2337d1455c8fb9ebadbe73e872dbdc388a627315 /spec/serializers/build_details_entity_spec.rb | |
parent | 68569584b728ac2dd5100593e9db302f362994f5 (diff) |
Incorporate review
Diffstat (limited to 'spec/serializers/build_details_entity_spec.rb')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb index 99829348348..8533cd77d1d 100644 --- a/spec/serializers/build_details_entity_spec.rb +++ b/spec/serializers/build_details_entity_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe BuildDetailsEntity do + set(:user) { create(:admin) } + it 'inherits from BuildEntity' do expect(described_class).to be < BuildEntity end @@ -17,7 +19,6 @@ describe BuildDetailsEntity do end context 'when the user has access to issues and merge requests' do - let(:user) { create(:admin) } let!(:merge_request) do create(:merge_request, source_project: project, source_branch: build.ref) end @@ -29,7 +30,27 @@ describe BuildDetailsEntity do it 'contains the needed key value pairs' do expect(subject).to include(:coverage, :erased_at, :duration) expect(subject).to include(:artifacts, :runner, :pipeline) - expect(subject).to include(:raw_path, :merge_request_path, :new_issue_path) + expect(subject).to include(:raw_path, :merge_request, :new_issue_path) + end + + it 'exposes details of the merge request' do + expect(subject[:merge_request]).to include(:iid, :path) + end + + context 'when the build has been erased' do + let!(:build) { create(:ci_build, :erasable, project: project) } + + it 'exposes the user whom erased the build' do + expect(subject).to include(:erase_path) + end + end + + context 'when the build has been erased' do + let!(:build) { create(:ci_build, erased_at: Time.now, project: project, erased_by: user) } + + it 'exposes the user whom erased the build' do + expect(subject).to include(:erased_by) + end end end |