From 7086dac42fff6e32bc38b389ffa104d9c21a159c Mon Sep 17 00:00:00 2001
From: Filipa Lacerda <filipa@gitlab.com>
Date: Tue, 29 Nov 2016 13:02:28 +0000
Subject: [PATCH] Changes after review

Fix broken test

Remove spinach tests for the builds tab
---
 app/controllers/projects/commit_controller.rb |  2 +-
 app/helpers/ci_status_helper.rb               |  2 +-
 config/routes/project.rb                      |  2 --
 features/project/commits/commits.feature      |  2 --
 features/steps/project/commits/commits.rb     |  9 ---------
 spec/features/projects/commit/builds_spec.rb  | 12 +++++++-----
 6 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb
index 3a5bf7d9ff5..791ed88db30 100644
--- a/app/controllers/projects/commit_controller.rb
+++ b/app/controllers/projects/commit_controller.rb
@@ -8,6 +8,7 @@ class Projects::CommitController < Projects::ApplicationController
 
   # Authorize
   before_action :require_non_empty_project
+  before_action :authorize_download_code!
   before_action :authorize_read_pipeline!, only: [:pipelines]
   before_action :commit
   before_action :define_commit_vars, only: [:show, :diff_for_path, :pipelines]
@@ -107,7 +108,6 @@ class Projects::CommitController < Projects::ApplicationController
 
   def define_status_vars
     @ci_pipelines = project.pipelines.where(sha: commit.sha)
-    @statuses = CommitStatus.where(pipeline: @ci_pipelines).relevant
   end
 
   def assign_change_commit_vars(mr_source_branch)
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index 94e91031680..94f3b480178 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -1,7 +1,7 @@
 module CiStatusHelper
   def ci_status_path(pipeline)
     project = pipeline.project
-    # builds_namespace_project_commit_path(project.namespace, project, pipeline.sha)
+    namespace_project_pipeline_path(project.namespace, project, pipeline)
   end
 
   # Is used by Commit and Merge Request Widget
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 99b0afcada1..2d261337594 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -33,8 +33,6 @@ constraints(ProjectUrlConstrainer.new) do
         member do
           get :branches
           get :pipelines
-          post :cancel_builds
-          post :retry_builds
           post :revert
           post :cherry_pick
           get :diff_for_path
diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature
index 1776c07e60e..3459cce03f9 100644
--- a/features/project/commits/commits.feature
+++ b/features/project/commits/commits.feature
@@ -47,8 +47,6 @@ Feature: Project Commits
     And repository contains ".gitlab-ci.yml" file
     When I click on commit link
     Then I see commit ci info
-    And I click status link
-    Then I see builds list
 
   Scenario: I browse commit with side-by-side diff view
     Given I click on commit link
diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb
index 007dfb67a77..18e267294e4 100644
--- a/features/steps/project/commits/commits.rb
+++ b/features/steps/project/commits/commits.rb
@@ -166,15 +166,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
     expect(page).to have_content "Pipeline #1 for 570e7b2a pending"
   end
 
-  step 'I click status link' do
-    find('.commit-ci-menu').click_link "Builds"
-  end
-
-  step 'I see builds list' do
-    expect(page).to have_content "Pipeline #1 for 570e7b2a pending"
-    expect(page).to have_content "1 build"
-  end
-
   step 'I search "submodules" commits' do
     fill_in 'commits-search', with: 'submodules'
   end
diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb
index fcdf7870f34..33f1c323af1 100644
--- a/spec/features/projects/commit/builds_spec.rb
+++ b/spec/features/projects/commit/builds_spec.rb
@@ -1,6 +1,6 @@
 require 'spec_helper'
 
-feature 'project commit builds' do
+feature 'project commit pipelines' do
   given(:project) { create(:project) }
 
   background do
@@ -16,11 +16,13 @@ feature 'project commit builds' do
                            ref: 'master')
     end
 
-    scenario 'user views commit builds page' do
-      visit builds_namespace_project_commit_path(project.namespace,
-                                                 project, project.commit.sha)
+    scenario 'user views commit pipelines page' do
+      visit pipelines_namespace_project_commit_path(project.namespace, project, project.commit.sha)
 
-      expect(page).to have_content('Builds')
+      page.within('.table-holder') do
+        expect(page).to have_content project.pipelines[0].status # pipeline status
+        expect(page).to have_content project.pipelines[0].id     # pipeline ids
+      end
     end
   end
 end
-- 
GitLab