Refactor ci commit specs by adding context blocks
This commit is contained in:
parent
bdb86ea6cf
commit
7518330aa1
1 changed files with 77 additions and 69 deletions
|
@ -158,6 +158,7 @@ describe Ci::Commit, models: true do
|
|||
stub_ci_commit_yaml_file(YAML.dump(yaml))
|
||||
end
|
||||
|
||||
context 'when builds are successful' do
|
||||
it 'properly creates builds' do
|
||||
expect(create_builds).to be_truthy
|
||||
expect(commit.builds.pluck(:name)).to contain_exactly('build')
|
||||
|
@ -180,8 +181,10 @@ describe Ci::Commit, models: true do
|
|||
commit.reload
|
||||
expect(commit.status).to eq('success')
|
||||
end
|
||||
end
|
||||
|
||||
it 'properly creates builds when test fails' do
|
||||
context 'when test job fails' do
|
||||
it 'properly creates builds' do
|
||||
expect(create_builds).to be_truthy
|
||||
expect(commit.builds.pluck(:name)).to contain_exactly('build')
|
||||
expect(commit.builds.pluck(:status)).to contain_exactly('pending')
|
||||
|
@ -203,8 +206,10 @@ describe Ci::Commit, models: true do
|
|||
commit.reload
|
||||
expect(commit.status).to eq('failed')
|
||||
end
|
||||
end
|
||||
|
||||
it 'properly creates builds when test and test_failure fails' do
|
||||
context 'when test and test_failure jobs fail' do
|
||||
it 'properly creates builds' do
|
||||
expect(create_builds).to be_truthy
|
||||
expect(commit.builds.pluck(:name)).to contain_exactly('build')
|
||||
expect(commit.builds.pluck(:status)).to contain_exactly('pending')
|
||||
|
@ -227,8 +232,10 @@ describe Ci::Commit, models: true do
|
|||
commit.reload
|
||||
expect(commit.status).to eq('failed')
|
||||
end
|
||||
end
|
||||
|
||||
it 'properly creates builds when deploy fails' do
|
||||
context 'when deploy job fails' do
|
||||
it 'properly creates builds' do
|
||||
expect(create_builds).to be_truthy
|
||||
expect(commit.builds.pluck(:name)).to contain_exactly('build')
|
||||
expect(commit.builds.pluck(:status)).to contain_exactly('pending')
|
||||
|
@ -252,6 +259,7 @@ describe Ci::Commit, models: true do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#finished_at" do
|
||||
let(:commit) { FactoryGirl.create :ci_commit }
|
||||
|
|
Loading…
Reference in a new issue