Commit cc8b8a60 authored by Shinya Maeda's avatar Shinya Maeda Committed by Alessio Caiazza

Add unit spec for Ci::Pipeline

parent 9266cd5e
......@@ -75,6 +75,18 @@ describe Ci::Pipeline, :mailer do
end
end
describe '#schedule' do
subject { pipeline.schedule }
let(:pipeline) { build(:ci_pipeline, status: :created) }
it 'changes pipeline status to schedule' do
subject
expect(pipeline).to be_scheduled
end
end
describe '#valid_commit_sha' do
context 'commit.sha can not start with 00000000' do
before do
......@@ -1288,6 +1300,19 @@ describe Ci::Pipeline, :mailer do
end
end
context 'when updating status to scheduled' do
before do
allow(pipeline)
.to receive_message_chain(:statuses, :latest, :status)
.and_return(:scheduled)
end
it 'updates pipeline status to scheduled' do
expect { pipeline.update_status }
.to change { pipeline.reload.status }.to 'scheduled'
end
end
context 'when statuses status was not recognized' do
before do
allow(pipeline)
......
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