From 7f63a8787ce454a61f72393ccbe22fc283ba8313 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 Oct 2015 17:54:49 +0200 Subject: [PATCH] Fix tests and few CI features Signed-off-by: Dmitriy Zaporozhets --- app/controllers/ci/projects_controller.rb | 1 + app/controllers/projects/commit_controller.rb | 2 +- app/views/projects/ci_settings/_form.html.haml | 2 +- config/routes.rb | 2 +- spec/requests/ci/builds_spec.rb | 17 ----------------- spec/requests/ci/commits_spec.rb | 16 ---------------- 6 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 spec/requests/ci/builds_spec.rb delete mode 100644 spec/requests/ci/commits_spec.rb diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb index 5484ae643a6..7777aa18031 100644 --- a/app/controllers/ci/projects_controller.rb +++ b/app/controllers/ci/projects_controller.rb @@ -1,5 +1,6 @@ module Ci class ProjectsController < Ci::ApplicationController + before_action :project before_action :authenticate_user!, except: [:build, :badge] before_action :authorize_access_project!, except: [:badge] before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml] diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index c08a90bddf0..7886f3c6deb 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -42,7 +42,7 @@ class Projects::CommitController < Projects::ApplicationController @ci_commit = @project.ci_commit(@commit.sha) @ci_commit.builds.running_or_pending.each(&:cancel) - redirect_to namespace_project_commit_path(project.namespace, project, commit.sha) + redirect_to ci_namespace_project_commit_path(project.namespace, project, commit.sha) end diff --git a/app/views/projects/ci_settings/_form.html.haml b/app/views/projects/ci_settings/_form.html.haml index 34125550206..d711413c6b9 100644 --- a/app/views/projects/ci_settings/_form.html.haml +++ b/app/views/projects/ci_settings/_form.html.haml @@ -8,7 +8,7 @@ Edit your #{link_to ".gitlab-ci.yml using web-editor", yaml_web_editor_link(@ci_project)} -- if @repository +- unless @project.empty_repo? %p Paste build status image for #{@repository.root_ref} with next link = link_to '#', class: 'badge-codes-toggle btn btn-default btn-xs' do diff --git a/config/routes.rb b/config/routes.rb index e91b09de9b0..efaf818a9e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -465,7 +465,7 @@ Gitlab::Application.routes.draw do member do get :branches get :ci - post :cancel_builds + get :cancel_builds end end diff --git a/spec/requests/ci/builds_spec.rb b/spec/requests/ci/builds_spec.rb deleted file mode 100644 index f68116c52aa..00000000000 --- a/spec/requests/ci/builds_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'spec_helper' - -describe "Builds" do - before do - @commit = FactoryGirl.create :ci_commit - @build = FactoryGirl.create :ci_build, commit: @commit - end - - describe "GET /:project/builds/:id/status.json" do - before do - get status_ci_project_build_path(@commit.project, @build), format: :json - end - - it { expect(response.status).to eq(200) } - it { expect(response.body).to include(@build.sha) } - end -end diff --git a/spec/requests/ci/commits_spec.rb b/spec/requests/ci/commits_spec.rb deleted file mode 100644 index f43a3982d71..00000000000 --- a/spec/requests/ci/commits_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'spec_helper' - -describe "Commits" do - before do - @commit = FactoryGirl.create :ci_commit - end - - describe "GET /:project/refs/:ref_name/commits/:id/status.json" do - before do - get status_ci_project_commits_path(@commit.project, @commit.sha), format: :json - end - - it { expect(response.status).to eq(200) } - it { expect(response.body).to include(@commit.sha) } - end -end