Commit c9749e22 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve build details serializable entity specs

parent 02759149
...@@ -140,6 +140,7 @@ FactoryGirl.define do ...@@ -140,6 +140,7 @@ FactoryGirl.define do
end end
trait :erased do trait :erased do
erasable
erased_at Time.now erased_at Time.now
erased_by factory: :user erased_by factory: :user
end end
......
...@@ -46,8 +46,8 @@ describe BuildDetailsEntity do ...@@ -46,8 +46,8 @@ describe BuildDetailsEntity do
expect(subject).to include(:new_issue_path) expect(subject).to include(:new_issue_path)
end end
it 'exposes details of the merge request' do it 'exposes correct details of the merge request' do
expect(subject[:merge_request]).to include(:iid, :path) expect(subject[:merge_request][:iid]).to eq merge_request.iid
end end
it 'has a correct merge request path' do it 'has a correct merge request path' do
...@@ -78,7 +78,7 @@ describe BuildDetailsEntity do ...@@ -78,7 +78,7 @@ describe BuildDetailsEntity do
end end
it 'exposes details of the merge request' do it 'exposes details of the merge request' do
expect(subject[:merge_request]).to include(:iid, :path) expect(subject[:merge_request][:iid]).to eq merge_request.iid
end end
it 'has a correct merge request path' do it 'has a correct merge request path' do
...@@ -88,7 +88,7 @@ describe BuildDetailsEntity do ...@@ -88,7 +88,7 @@ describe BuildDetailsEntity do
end end
context 'when the build has been erased' do context 'when the build has been erased' do
let(:build) { create(:ci_build, :erasable, project: project) } let(:build) { create(:ci_build, :erased, project: project) }
it 'exposes the user whom erased the build' do it 'exposes the user whom erased the build' do
expect(subject).to include(:erase_path) expect(subject).to include(:erase_path)
...@@ -96,7 +96,7 @@ describe BuildDetailsEntity do ...@@ -96,7 +96,7 @@ describe BuildDetailsEntity do
end end
context 'when the build has been erased' do context 'when the build has been erased' do
let(:build) { create(:ci_build, erased_at: Time.now, project: project, erased_by: user) } let(:build) { create(:ci_build, :erased, project: project, erased_by: user) }
it 'exposes the user whom erased the build' do it 'exposes the user whom erased the build' do
expect(subject).to include(:erased_by) expect(subject).to include(:erased_by)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment