Commit 7518330a authored by Grzegorz Bizon's avatar Grzegorz Bizon

Refactor ci commit specs by adding context blocks

parent bdb86ea6
......@@ -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 }
......
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