Fix ci build routing and few tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
27b75b2b2d
commit
82b6a17ca7
|
@ -17,7 +17,7 @@ module Ci
|
||||||
if params[:return_to]
|
if params[:return_to]
|
||||||
redirect_to URI.parse(params[:return_to]).path
|
redirect_to URI.parse(params[:return_to]).path
|
||||||
else
|
else
|
||||||
redirect_to ci_project_build_path(project, build)
|
redirect_to build_path(build)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ module Ci
|
||||||
def cancel
|
def cancel
|
||||||
@build.cancel
|
@build.cancel
|
||||||
|
|
||||||
redirect_to ci_project_build_path(@project, @build)
|
redirect_to build_path(@build)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
@ -44,5 +44,9 @@ module Ci
|
||||||
def commit_by_sha
|
def commit_by_sha
|
||||||
@project.commits.find_by(sha: params[:id])
|
@project.commits.find_by(sha: params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_path(build)
|
||||||
|
namespace_project_build_path(build.gl_project.namespace, build.gl_project, build)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,6 @@ module BuildsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_url(build)
|
def build_url(build)
|
||||||
ci_project_build_url(build.project, build)
|
namespace_project_build_path(build.gl_project, build.project, build)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,7 +144,7 @@ module Ci
|
||||||
state :canceled, value: 'canceled'
|
state :canceled, value: 'canceled'
|
||||||
end
|
end
|
||||||
|
|
||||||
delegate :sha, :short_sha, :project,
|
delegate :sha, :short_sha, :project, :gl_project,
|
||||||
to: :commit, prefix: false
|
to: :commit, prefix: false
|
||||||
|
|
||||||
def before_sha
|
def before_sha
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe "Builds" do
|
describe "Builds" do
|
||||||
context :private_project do
|
|
||||||
before do
|
before do
|
||||||
|
login_as(:user)
|
||||||
@commit = FactoryGirl.create :ci_commit
|
@commit = FactoryGirl.create :ci_commit
|
||||||
@build = FactoryGirl.create :ci_build, commit: @commit
|
@build = FactoryGirl.create :ci_build, commit: @commit
|
||||||
login_as :user
|
@gl_project = @commit.project.gl_project
|
||||||
@commit.project.gl_project.team << [@user, :master]
|
@gl_project.team << [@user, :master]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /:project/builds/:id/cancel" do
|
describe "GET /:project/builds/:id/cancel" do
|
||||||
|
@ -21,8 +21,7 @@ describe "Builds" do
|
||||||
|
|
||||||
describe "POST /:project/builds/:id/retry" do
|
describe "POST /:project/builds/:id/retry" do
|
||||||
before do
|
before do
|
||||||
@build.cancel!
|
visit cancel_ci_project_build_path(@commit.project, @build)
|
||||||
visit ci_project_build_path(@commit.project, @build)
|
|
||||||
click_link 'Retry'
|
click_link 'Retry'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -30,4 +29,3 @@ describe "Builds" do
|
||||||
it { expect(page).to have_content 'Cancel' }
|
it { expect(page).to have_content 'Cancel' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in New Issue