Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
82b6a17c
Commit
82b6a17c
authored
Oct 06, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ci build routing and few tests
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
27b75b2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
26 deletions
+28
-26
app/controllers/ci/builds_controller.rb
app/controllers/ci/builds_controller.rb
+6
-2
app/helpers/builds_helper.rb
app/helpers/builds_helper.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
spec/features/ci/builds_spec.rb
spec/features/ci/builds_spec.rb
+20
-22
No files found.
app/controllers/ci/builds_controller.rb
View file @
82b6a17c
...
@@ -17,7 +17,7 @@ module Ci
...
@@ -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
...
@@ -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
...
@@ -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
app/helpers/builds_helper.rb
View file @
82b6a17c
...
@@ -8,6 +8,6 @@ module BuildsHelper
...
@@ -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
app/models/ci/build.rb
View file @
82b6a17c
...
@@ -144,7 +144,7 @@ module Ci
...
@@ -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
...
...
spec/features/ci/builds_spec.rb
View file @
82b6a17c
require
'spec_helper'
require
'spec_helper'
describe
"Builds"
do
describe
"Builds"
do
context
:private_project
do
before
do
login_as
(
:user
)
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
@gl_project
=
@commit
.
project
.
gl_project
@gl_project
.
team
<<
[
@user
,
:master
]
end
describe
"GET /:project/builds/:id/cancel"
do
before
do
before
do
@commit
=
FactoryGirl
.
create
:ci_commit
@build
.
run!
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
visit
cancel_ci_project_build_path
(
@commit
.
project
,
@build
)
login_as
:user
@commit
.
project
.
gl_project
.
team
<<
[
@user
,
:master
]
end
end
describe
"GET /:project/builds/:id/cancel"
do
it
{
expect
(
page
).
to
have_content
'canceled'
}
before
do
it
{
expect
(
page
).
to
have_content
'Retry'
}
@build
.
run!
end
visit
cancel_ci_project_build_path
(
@commit
.
project
,
@build
)
end
it
{
expect
(
page
).
to
have_content
'canceled'
}
describe
"POST /:project/builds/:id/retry"
do
it
{
expect
(
page
).
to
have_content
'Retry'
}
before
do
visit
cancel_ci_project_build_path
(
@commit
.
project
,
@build
)
click_link
'Retry'
end
end
describe
"POST /:project/builds/:id/retry"
do
it
{
expect
(
page
).
to
have_content
'pending'
}
before
do
it
{
expect
(
page
).
to
have_content
'Cancel'
}
@build
.
cancel!
visit
ci_project_build_path
(
@commit
.
project
,
@build
)
click_link
'Retry'
end
it
{
expect
(
page
).
to
have_content
'pending'
}
it
{
expect
(
page
).
to
have_content
'Cancel'
}
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment