提交 cc8b8a60 编写于 作者: S Shinya Maeda 提交者: Alessio Caiazza

Add unit spec for Ci::Pipeline

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册