Commit 21c5270a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't try to load status when there is no commit

This could happen when the repository is missing.

In which case cache needs to be cleared
parent c4956091
......@@ -37,6 +37,8 @@ module Ci
end
def load_from_commit
return unless commit
self.sha = commit.sha
self.status = commit.status
end
......
......@@ -79,6 +79,14 @@ describe Ci::PipelineStatus do
expect(pipeline_status.status).to eq('success')
expect(pipeline_status.sha).to eq(project.commit.sha)
end
it "doesn't fail for an empty project" do
status_for_empty_commit = described_class.new(create(:empty_project))
status_for_empty_commit.load_status
expect(status_for_empty_commit).to be_loaded
end
end
describe "#store_in_cache", :redis do
......
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