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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4d9f6d78
Commit
4d9f6d78
authored
Jun 29, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix jenkins service specs
parent
d9bd7172
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
spec/models/project_services/jenkins_service_spec.rb
spec/models/project_services/jenkins_service_spec.rb
+17
-9
No files found.
spec/models/project_services/jenkins_service_spec.rb
View file @
4d9f6d78
...
...
@@ -8,19 +8,26 @@ describe JenkinsService do
let
(
:project
)
{
create
(
:project
)
}
let
(
:jenkins_url
)
{
'http://jenkins.example.com/'
}
let
(
:jenkins_hook_url
)
{
jenkins_url
+
'project/my_project'
}
let
(
:jenkins_username
)
{
'u$er name%2520'
}
let
(
:jenkins_password
)
{
'pas$ word'
}
let
(
:jenkins_params
)
do
{
active:
true
,
project:
project
,
properties:
{
password:
'pas$ word'
,
username:
'u$er name%2520'
,
jenkins_url:
'http://jenkins.example.com/'
,
password:
jenkins_password
,
username:
jenkins_username
,
jenkins_url:
jenkins_url
,
project_name:
'my_project'
}
}
end
let
(
:jenkins_authorization
)
{
"Basic "
+
::
Base64
.
strict_encode64
(
jenkins_username
+
':'
+
jenkins_password
)
}
describe
'username validation'
do
before
do
@jenkins_service
=
described_class
.
create
(
...
...
@@ -121,7 +128,7 @@ describe JenkinsService do
project
=
create
(
:project
,
name:
'project'
)
push_sample_data
=
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
jenkins_service
=
described_class
.
create
(
jenkins_params
)
stub_request
(
:post
,
jenkins_
service
.
hook_url
)
stub_request
(
:post
,
jenkins_
hook_url
).
with
(
headers:
{
'Authorization'
=>
jenkins_authorization
}
)
result
=
jenkins_service
.
test
(
push_sample_data
)
...
...
@@ -135,13 +142,13 @@ describe JenkinsService do
project
=
create
(
:project
,
name:
'project'
)
push_sample_data
=
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
jenkins_service
=
described_class
.
create
(
jenkins_params
)
stub_request
(
:post
,
jenkins_
service
.
hook_url
)
stub_request
(
:post
,
jenkins_hook_url
)
jenkins_service
.
execute
(
push_sample_data
)
expect
(
a_request
(
:post
,
jenkins_
service
.
hook_url
)
.
with
(
headers:
{
'X-Gitlab-Event'
=>
'Push Hook'
})
a_request
(
:post
,
jenkins_hook_url
)
.
with
(
headers:
{
'X-Gitlab-Event'
=>
'Push Hook'
,
'Authorization'
=>
jenkins_authorization
})
).
to
have_been_made
.
once
end
...
...
@@ -150,12 +157,13 @@ describe JenkinsService do
project
=
create
(
:project
,
name:
'project'
)
push_sample_data
=
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
jenkins_service
=
described_class
.
create
(
jenkins_params
)
stub_request
(
:post
,
jenkins_
service
.
hook_url
)
stub_request
(
:post
,
jenkins_hook_url
)
jenkins_service
.
execute
(
push_sample_data
)
expect
(
a_request
(
:post
,
'http://u%24er%20name%252520:pas%24%20word@jenkins.example.com/project/my_project'
)
a_request
(
:post
,
'http://jenkins.example.com/project/my_project'
)
.
with
(
headers:
{
'Authorization'
=>
jenkins_authorization
})
).
to
have_been_made
.
once
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