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
Tatuya Kamada
gitlab-ce
Commits
5285e01d
Commit
5285e01d
authored
Sep 15, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: features/ci/runners_spec.rb
parent
9621f433
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
12 deletions
+19
-12
app/controllers/ci/runner_projects_controller.rb
app/controllers/ci/runner_projects_controller.rb
+1
-1
app/models/user.rb
app/models/user.rb
+9
-0
spec/features/ci/runners_spec.rb
spec/features/ci/runners_spec.rb
+9
-11
No files found.
app/controllers/ci/runner_projects_controller.rb
View file @
5285e01d
...
@@ -9,7 +9,7 @@ module Ci
...
@@ -9,7 +9,7 @@ module Ci
def
create
def
create
@runner
=
Ci
::
Runner
.
find
(
params
[
:runner_project
][
:runner_id
])
@runner
=
Ci
::
Runner
.
find
(
params
[
:runner_project
][
:runner_id
])
return
head
(
403
)
unless
current_user
.
authorized_runners
.
include?
(
@runner
)
return
head
(
403
)
unless
current_user
.
ci_
authorized_runners
.
include?
(
@runner
)
if
@runner
.
assign_to
(
project
,
current_user
)
if
@runner
.
assign_to
(
project
,
current_user
)
redirect_to
ci_project_runners_path
(
project
)
redirect_to
ci_project_runners_path
(
project
)
...
...
app/models/user.rb
View file @
5285e01d
...
@@ -753,4 +753,13 @@ class User < ActiveRecord::Base
...
@@ -753,4 +753,13 @@ class User < ActiveRecord::Base
def
can_be_removed?
def
can_be_removed?
!
solo_owned_groups
.
present?
!
solo_owned_groups
.
present?
end
end
def
ci_authorized_projects
@ci_authorized_projects
||=
Ci
::
Project
.
where
(
gitlab_id:
authorized_projects
)
end
def
ci_authorized_runners
Ci
::
Runner
.
specific
.
includes
(
:runner_projects
).
where
(
ci_runner_projects:
{
project_id:
ci_authorized_projects
}
)
end
end
end
spec/features/ci/runners_spec.rb
View file @
5285e01d
require
'spec_helper'
require
'spec_helper'
describe
"Runners"
do
describe
"Runners"
do
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
login_as
:user
login_as
(
user
)
end
end
describe
"specific runners"
do
describe
"specific runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@project
=
FactoryGirl
.
create
:ci_project
@project2
=
FactoryGirl
.
create
:ci_project
@project
.
gl_project
.
team
<<
[
user
,
:master
]
stub_js_gitlab_calls
# all projects should be authorized for user
@project2
=
FactoryGirl
.
create
:ci_project
allow_any_instance_of
(
Network
).
to
receive
(
:projects
).
and_return
([
@project2
.
gl_project
.
team
<<
[
user
,
:master
]
OpenStruct
.
new
({
id:
@project
.
gitlab_id
}),
OpenStruct
.
new
({
id:
@project2
.
gitlab_id
})
])
@shared_runner
=
FactoryGirl
.
create
:ci_shared_runner
@shared_runner
=
FactoryGirl
.
create
:ci_shared_runner
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
...
@@ -60,14 +58,14 @@ describe "Runners" do
...
@@ -60,14 +58,14 @@ describe "Runners" do
click_on
"Remove runner"
click_on
"Remove runner"
end
end
expect
(
Runner
.
exists?
(
id:
@specific_runner
)).
to
be_falsey
expect
(
Ci
::
Runner
.
exists?
(
id:
@specific_runner
)).
to
be_falsey
end
end
end
end
describe
"shared runners"
do
describe
"shared runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@project
=
FactoryGirl
.
create
:ci_project
stub_js_gitlab_calls
@project
.
gl_project
.
team
<<
[
user
,
:master
]
end
end
it
"enables shared runners"
do
it
"enables shared runners"
do
...
@@ -82,7 +80,7 @@ describe "Runners" do
...
@@ -82,7 +80,7 @@ describe "Runners" do
describe
"show page"
do
describe
"show page"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@project
=
FactoryGirl
.
create
:ci_project
stub_js_gitlab_calls
@project
.
gl_project
.
team
<<
[
user
,
:master
]
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
@specific_runner
=
FactoryGirl
.
create
:ci_specific_runner
@project
.
runners
<<
@specific_runner
@project
.
runners
<<
@specific_runner
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