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
7ef3cf64
Commit
7ef3cf64
authored
Jun 26, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rm use of deprecated webmock api in campfire_service_spec
parent
e57d1bbf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
spec/models/project_services/campfire_service_spec.rb
spec/models/project_services/campfire_service_spec.rb
+6
-5
No files found.
spec/models/project_services/campfire_service_spec.rb
View file @
7ef3cf64
...
...
@@ -39,21 +39,22 @@ describe CampfireService, models: true do
room:
'test-room'
)
@sample_data
=
Gitlab
::
DataBuilder
::
Push
.
build_sample
(
project
,
user
)
@rooms_url
=
'https://verySecret:X@project-name.campfirenow.com/rooms.json'
@rooms_url
=
'https://project-name.campfirenow.com/rooms.json'
@auth
=
%w(verySecret X)
@headers
=
{
'Content-Type'
=>
'application/json; charset=utf-8'
}
end
it
"calls Campfire API to get a list of rooms and speak in a room"
do
# make sure a valid list of rooms is returned
body
=
File
.
read
(
Rails
.
root
+
'spec/fixtures/project_services/campfire/rooms.json'
)
WebMock
.
stub_request
(
:get
,
@rooms_url
).
to_return
(
WebMock
.
stub_request
(
:get
,
@rooms_url
).
with
(
basic_auth:
@auth
).
to_return
(
body:
body
,
status:
200
,
headers:
@headers
)
# stub the speak request with the room id found in the previous request's response
speak_url
=
'https://
verySecret:X@
project-name.campfirenow.com/room/123/speak.json'
WebMock
.
stub_request
(
:post
,
speak_url
)
speak_url
=
'https://project-name.campfirenow.com/room/123/speak.json'
WebMock
.
stub_request
(
:post
,
speak_url
)
.
with
(
basic_auth:
@auth
)
@campfire_service
.
execute
(
@sample_data
)
...
...
@@ -66,7 +67,7 @@ describe CampfireService, models: true do
it
"calls Campfire API to get a list of rooms but shouldn't speak in a room"
do
# return a list of rooms that do not contain a room named 'test-room'
body
=
File
.
read
(
Rails
.
root
+
'spec/fixtures/project_services/campfire/rooms2.json'
)
WebMock
.
stub_request
(
:get
,
@rooms_url
).
to_return
(
WebMock
.
stub_request
(
:get
,
@rooms_url
).
with
(
basic_auth:
@auth
).
to_return
(
body:
body
,
status:
200
,
headers:
@headers
...
...
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