Add basic tests for build entity used by serialzier
This commit is contained in:
parent
6c94adea35
commit
a68e7e605a
1 changed files with 24 additions and 0 deletions
24
spec/serializers/build_entity_spec.rb
Normal file
24
spec/serializers/build_entity_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe BuildEntity do
|
||||||
|
subject do
|
||||||
|
described_class.new(build, request: double).as_json
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when build is a regular job' do
|
||||||
|
let(:build) { create(:ci_build) }
|
||||||
|
|
||||||
|
it 'contains url to build page and retry action' do
|
||||||
|
expect(subject).to include(:build_url, :retry_url)
|
||||||
|
expect(subject).not_to include(:play_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when build is a manual action' do
|
||||||
|
let(:build) { create(:ci_build, :manual) }
|
||||||
|
|
||||||
|
it 'contains url to play action' do
|
||||||
|
expect(subject).to include(:play_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue