Commit 5905d89b authored by Shinya Maeda's avatar Shinya Maeda

Add spec for build presenter

parent 41fe9edc
...@@ -218,6 +218,42 @@ describe Ci::BuildPresenter do ...@@ -218,6 +218,42 @@ describe Ci::BuildPresenter do
end end
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 describe '#callout_failure_message' do
let(:build) { create(:ci_build, :failed, :api_failure) } let(:build) { create(:ci_build, :failed, :api_failure) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment