summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-12 21:27:59 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-09-12 21:27:59 +0800
commitaf7d383675269523ca4c6b7bddf8a34f6054f6af (patch)
tree5b50e6a9636a8e0ff096b96c3fee12086de264a8
parent6baf9971db231a2c9923bd4d73e1f59fe255aab8 (diff)
downloadgitlab-ce-af7d383675269523ca4c6b7bddf8a34f6054f6af.tar.gz
should show the status of the latest one
-rw-r--r--app/models/commit.rb2
-rw-r--r--spec/requests/api/commits_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index e64fd1e0c1b..0e2ab76d347 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -231,7 +231,7 @@ class Commit
def status
return @status if defined?(@status)
- @status ||= pipelines.status
+ @status ||= pipelines.order(:id).last.try(:status)
end
def revert_branch_name
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index 5b3dc60aba2..e24e92e063c 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -110,7 +110,7 @@ describe API::API, api: true do
get api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}", user)
expect(response).to have_http_status(200)
- expect(json_response['status']).to be_nil
+ expect(json_response['status']).to eq('created')
end
end