Commit ce47e982 authored by Allen Cook's avatar Allen Cook Committed by Shinya Maeda

Ensure ci_environment_status always return latest deployment status

Changelog: fixed
parent 94f1cb1d
......@@ -51,7 +51,7 @@ class EnvironmentStatus
def deployment
strong_memoize(:deployment) do
Deployment.where(environment: environment).find_by_sha(sha)
Deployment.where(environment: environment).ordered.find_by_sha(sha)
end
end
......
......@@ -34,6 +34,13 @@ RSpec.describe EnvironmentStatus do
subject { environment_status.deployment }
it { is_expected.to eq(deployment) }
context 'multiple deployments' do
it {
new_deployment = create(:deployment, :succeed, environment: deployment.environment, sha: deployment.sha )
is_expected.to eq(new_deployment)
}
end
end
# $ git diff --stat pages-deploy-target...pages-deploy
......
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