summaryrefslogtreecommitdiff
path: root/spec/presenters/ci
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-10-03 15:05:50 +0900
committerShinya Maeda <shinya@gitlab.com>2018-10-03 15:05:50 +0900
commit5905d89b924fc518a3896ac6b4ccec11a164df5d (patch)
treebc6bb8e31bc5b2547e2df3765cf825059ee33eb7 /spec/presenters/ci
parent41fe9edcf75a96db2f29c172828e6adf0ca5b0c9 (diff)
downloadgitlab-ce-5905d89b924fc518a3896ac6b4ccec11a164df5d.tar.gz
Add spec for build presenter
Diffstat (limited to 'spec/presenters/ci')
-rw-r--r--spec/presenters/ci/build_presenter_spec.rb36
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) }