From af7214d0f077f738ed57194feb0cd468c43d4310 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 11 Apr 2016 16:55:40 +0200 Subject: Fix specs --- app/controllers/projects/commit_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/controllers/projects') diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index f9a4aeaa627..72078c3cc68 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -38,13 +38,13 @@ class Projects::CommitController < Projects::ApplicationController end def cancel_builds - ci_commit.builds.running_or_pending.each(&:cancel) + ci_builds.running_or_pending.each(&:cancel) redirect_back_or_default default: builds_namespace_project_commit_path(project.namespace, project, commit.sha) end def retry_builds - ci_commit.builds.latest.failed.each do |build| + ci_builds.latest.failed.each do |build| if build.retryable? Ci::Build.retry(build) end @@ -98,6 +98,10 @@ class Projects::CommitController < Projects::ApplicationController @ci_commits ||= project.ci_commits.where(sha: commit.sha) end + def ci_builds + @ci_builds ||= Ci::Build.where(commit: ci_commits) + end + def define_show_vars return git_not_found! unless commit -- cgit v1.2.1