From a68e7e605aa684e88523f6e28f995c3b497945c6 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 3 Nov 2016 14:22:19 +0100 Subject: [PATCH] Add basic tests for build entity used by serialzier --- spec/serializers/build_entity_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spec/serializers/build_entity_spec.rb diff --git a/spec/serializers/build_entity_spec.rb b/spec/serializers/build_entity_spec.rb new file mode 100644 index 00000000000..b7acc2066ba --- /dev/null +++ b/spec/serializers/build_entity_spec.rb @@ -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