Commit 7f63a878 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix tests and few CI features

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a30b68fe
module Ci module Ci
class ProjectsController < Ci::ApplicationController class ProjectsController < Ci::ApplicationController
before_action :project
before_action :authenticate_user!, except: [:build, :badge] before_action :authenticate_user!, except: [:build, :badge]
before_action :authorize_access_project!, except: [:badge] before_action :authorize_access_project!, except: [:badge]
before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml] before_action :authorize_manage_project!, only: [:toggle_shared_runners, :dumped_yaml]
......
...@@ -42,7 +42,7 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -42,7 +42,7 @@ class Projects::CommitController < Projects::ApplicationController
@ci_commit = @project.ci_commit(@commit.sha) @ci_commit = @project.ci_commit(@commit.sha)
@ci_commit.builds.running_or_pending.each(&:cancel) @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 end
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Edit your Edit your
#{link_to ".gitlab-ci.yml using web-editor", yaml_web_editor_link(@ci_project)} #{link_to ".gitlab-ci.yml using web-editor", yaml_web_editor_link(@ci_project)}
- if @repository - unless @project.empty_repo?
%p %p
Paste build status image for #{@repository.root_ref} with next link Paste build status image for #{@repository.root_ref} with next link
= link_to '#', class: 'badge-codes-toggle btn btn-default btn-xs' do = link_to '#', class: 'badge-codes-toggle btn btn-default btn-xs' do
......
...@@ -465,7 +465,7 @@ Gitlab::Application.routes.draw do ...@@ -465,7 +465,7 @@ Gitlab::Application.routes.draw do
member do member do
get :branches get :branches
get :ci get :ci
post :cancel_builds get :cancel_builds
end end
end end
......
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
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
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