Add basic tests for build entity used by serialzier

This commit is contained in:
Grzegorz Bizon 2016-11-03 14:22:19 +01:00
parent 6c94adea35
commit a68e7e605a

View 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