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
Jérome Perrin
gitlab-ce
Commits
2d4744c3
Commit
2d4744c3
authored
Aug 24, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make default trigger factory generate an owner
And specify owners more clearly
parent
c1f12ff5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
spec/factories/ci/triggers.rb
spec/factories/ci/triggers.rb
+2
-0
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+2
-4
spec/requests/api/v3/triggers_spec.rb
spec/requests/api/v3/triggers_spec.rb
+4
-1
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+2
-1
No files found.
spec/factories/ci/triggers.rb
View file @
2d4744c3
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:ci_trigger_without_token
,
class:
Ci
::
Trigger
do
factory
:ci_trigger_without_token
,
class:
Ci
::
Trigger
do
owner
factory
:ci_trigger
do
factory
:ci_trigger
do
sequence
(
:token
)
{
|
n
|
"token
#{
n
}
"
}
sequence
(
:token
)
{
|
n
|
"token
#{
n
}
"
}
end
end
...
...
spec/requests/api/triggers_spec.rb
View file @
2d4744c3
...
@@ -8,8 +8,8 @@ describe API::Triggers do
...
@@ -8,8 +8,8 @@ describe API::Triggers do
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user2
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user2
,
project:
project
)
}
let!
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
let!
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
,
owner:
user
)
}
let!
(
:trigger2
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token_2
)
}
let!
(
:trigger2
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token_2
,
owner:
user2
)
}
let!
(
:trigger_request
)
{
create
(
:ci_trigger_request
,
trigger:
trigger
,
created_at:
'2015-01-01 12:13:14'
)
}
let!
(
:trigger_request
)
{
create
(
:ci_trigger_request
,
trigger:
trigger
,
created_at:
'2015-01-01 12:13:14'
)
}
describe
'POST /projects/:project_id/trigger/pipeline'
do
describe
'POST /projects/:project_id/trigger/pipeline'
do
...
@@ -254,8 +254,6 @@ describe API::Triggers do
...
@@ -254,8 +254,6 @@ describe API::Triggers do
describe
'POST /projects/:id/triggers/:trigger_id/take_ownership'
do
describe
'POST /projects/:id/triggers/:trigger_id/take_ownership'
do
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
it
'updates owner'
do
it
'updates owner'
do
expect
(
trigger
.
owner
).
to
be_nil
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take_ownership"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/triggers/
#{
trigger
.
id
}
/take_ownership"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
...
...
spec/requests/api/v3/triggers_spec.rb
View file @
2d4744c3
...
@@ -7,7 +7,10 @@ describe API::V3::Triggers do
...
@@ -7,7 +7,10 @@ describe API::V3::Triggers do
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:master
)
{
create
(
:project_member
,
:master
,
user:
user
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user2
,
project:
project
)
}
let!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user2
,
project:
project
)
}
let!
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
let!
(
:trigger
)
do
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
,
owner:
user
)
end
describe
'POST /projects/:project_id/trigger'
do
describe
'POST /projects/:project_id/trigger'
do
let!
(
:project2
)
{
create
(
:project
)
}
let!
(
:project2
)
{
create
(
:project
)
}
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
2d4744c3
...
@@ -470,7 +470,8 @@ describe Ci::CreatePipelineService do
...
@@ -470,7 +470,8 @@ describe Ci::CreatePipelineService do
context
'when ref is not protected'
do
context
'when ref is not protected'
do
context
'when trigger belongs to no one'
do
context
'when trigger belongs to no one'
do
let
(
:user
)
{}
let
(
:user
)
{}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request
)
}
let
(
:trigger
)
{
create
(
:ci_trigger
,
owner:
nil
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request
,
trigger:
trigger
)
}
it
'creates a pipeline'
do
it
'creates a pipeline'
do
expect
(
execute_service
(
trigger_request:
trigger_request
))
expect
(
execute_service
(
trigger_request:
trigger_request
))
...
...
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