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
0c946317
Commit
0c946317
authored
May 26, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow HipChat API version to be blank and default to v2
Closes #772
parent
dfa1d96a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
5 deletions
+29
-5
CHANGELOG
CHANGELOG
+1
-0
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+1
-1
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+27
-4
No files found.
CHANGELOG
View file @
0c946317
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.12.0 (unreleased)
v 7.12.0 (unreleased)
- Allow HipChat API version to be blank and default to v2 (Stan Hu)
- Add web hook support for note events (Stan Hu)
- Add web hook support for note events (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
...
...
app/models/project_services/hipchat_service.rb
View file @
0c946317
...
@@ -63,7 +63,7 @@ class HipchatService < Service
...
@@ -63,7 +63,7 @@ class HipchatService < Service
private
private
def
gate
def
gate
options
=
{
api_version:
api_version
||
'v2'
}
options
=
{
api_version:
api_version
.
present?
?
api_version
:
'v2'
}
options
[
:server_url
]
=
server
unless
server
.
blank?
options
[
:server_url
]
=
server
unless
server
.
blank?
@gate
||=
HipChat
::
Client
.
new
(
token
,
options
)
@gate
||=
HipChat
::
Client
.
new
(
token
,
options
)
end
end
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
0c946317
...
@@ -32,21 +32,44 @@ describe HipchatService do
...
@@ -32,21 +32,44 @@ describe HipchatService do
let
(
:project
)
{
create
(
:project
,
name:
'project'
)
}
let
(
:project
)
{
create
(
:project
,
name:
'project'
)
}
let
(
:api_url
)
{
'https://hipchat.example.com/v2/room/123456/notification?auth_token=verySecret'
}
let
(
:api_url
)
{
'https://hipchat.example.com/v2/room/123456/notification?auth_token=verySecret'
}
let
(
:project_name
)
{
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
}
let
(
:project_name
)
{
project
.
name_with_namespace
.
gsub
(
/\s/
,
''
)
}
let
(
:token
)
{
'verySecret'
}
let
(
:server_url
)
{
'https://hipchat.example.com'
}
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
before
(
:each
)
do
before
(
:each
)
do
hipchat
.
stub
(
hipchat
.
stub
(
project_id:
project
.
id
,
project_id:
project
.
id
,
project:
project
,
project:
project
,
room:
123456
,
room:
123456
,
server:
'https://hipchat.example.com'
,
server:
server_url
,
token:
'verySecret'
token:
token
)
)
WebMock
.
stub_request
(
:post
,
api_url
)
WebMock
.
stub_request
(
:post
,
api_url
)
end
end
context
'push events'
do
it
'should use v1 if version is provided'
do
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
hipchat
.
stub
(
api_version:
'v1'
)
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
with
(
token
,
api_version:
'v1'
,
server_url:
server_url
).
and_return
(
double
(
:hipchat_service
).
as_null_object
)
hipchat
.
execute
(
push_sample_data
)
end
it
'should use v2 as the version when nothing is provided'
do
hipchat
.
stub
(
api_version:
''
)
expect
(
HipChat
::
Client
).
to
receive
(
:new
).
with
(
token
,
api_version:
'v2'
,
server_url:
server_url
).
and_return
(
double
(
:hipchat_service
).
as_null_object
)
hipchat
.
execute
(
push_sample_data
)
end
context
'push events'
do
it
"should call Hipchat API for push events"
do
it
"should call Hipchat API for push events"
do
hipchat
.
execute
(
push_sample_data
)
hipchat
.
execute
(
push_sample_data
)
...
...
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