diff options
Diffstat (limited to 'spec/serializers/ci/job_entity_spec.rb')
-rw-r--r-- | spec/serializers/ci/job_entity_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/serializers/ci/job_entity_spec.rb b/spec/serializers/ci/job_entity_spec.rb index ba68b9a6c16..05b9e38444c 100644 --- a/spec/serializers/ci/job_entity_spec.rb +++ b/spec/serializers/ci/job_entity_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Ci::JobEntity do let(:user) { create(:user) } - let(:job) { create(:ci_build) } + let(:job) { create(:ci_build, :running) } let(:project) { job.project } let(:request) { double('request') } @@ -21,6 +21,11 @@ RSpec.describe Ci::JobEntity do subject { entity.as_json } + it 'contains started' do + expect(subject).to include(:started) + expect(subject[:started]).to eq(true) + end + it 'contains complete to indicate if a pipeline is completed' do expect(subject).to include(:complete) end @@ -128,6 +133,15 @@ RSpec.describe Ci::JobEntity do end end + context 'when job is running' do + let_it_be(:job) { create(:ci_build, :running) } + + it 'contains started_at' do + expect(subject[:started]).to be_truthy + expect(subject[:started_at]).to eq(job.started_at) + end + end + context 'when job is generic commit status' do let(:job) { create(:generic_commit_status, target_url: 'http://google.com') } |