diff options
Diffstat (limited to 'spec/presenters/ci/build_presenter_spec.rb')
-rw-r--r-- | spec/presenters/ci/build_presenter_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/presenters/ci/build_presenter_spec.rb b/spec/presenters/ci/build_presenter_spec.rb index 547d95e0908..b2fe10bb0b0 100644 --- a/spec/presenters/ci/build_presenter_spec.rb +++ b/spec/presenters/ci/build_presenter_spec.rb @@ -218,6 +218,42 @@ describe Ci::BuildPresenter do end end + describe '#execute_in' do + subject { presenter.execute_in } + + context 'when build is scheduled' do + context 'when schedule is not expired' do + let(:build) { create(:ci_build, :scheduled) } + + it 'returns execution time' do + Timecop.freeze do + is_expected.to eq(60.0) + end + end + end + + context 'when schedule is expired' do + let(:build) { create(:ci_build, :expired_scheduled) } + + it 'returns execution time' do + Timecop.freeze do + is_expected.to eq(0) + end + end + end + end + + context 'when build is not delayed' do + let(:build) { create(:ci_build) } + + it 'does not return execution time' do + Timecop.freeze do + is_expected.to be_falsy + end + end + end + end + describe '#callout_failure_message' do let(:build) { create(:ci_build, :failed, :api_failure) } |