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
Léo-Paul Géneau
gitlab-ce
Commits
36eed726
Commit
36eed726
authored
Dec 20, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add controller test
parent
4a03fae9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
spec/controllers/projects/mattermosts_controller_spec.rb
spec/controllers/projects/mattermosts_controller_spec.rb
+53
-0
No files found.
spec/controllers/projects/mattermosts_controller_spec.rb
0 → 100644
View file @
36eed726
require
'spec_helper'
describe
Projects
::
MattermostsController
do
let!
(
:project
)
{
create
(
:empty_project
)
}
let!
(
:user
)
{
create
(
:user
)
}
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
describe
'GET #new'
do
before
do
get
(
:new
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
)
end
it
'accepts the request'
do
expect
(
response
).
to
have_http_status
(
200
)
end
end
describe
'POST #create'
do
let
(
:mattermost_params
)
{
{
trigger:
'http://localhost:3000/trigger'
,
team_id:
'abc'
}
}
subject
do
post
(
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
mattermost:
mattermost_params
)
end
context
'no request can be made to mattermost'
do
it
'shows the error'
do
expect
(
controller
).
to
set_flash
[
:alert
].
to
/\AFailed to open TCP connection to/
end
end
context
'the request is succesull'
do
before
do
allow_any_instance_of
(
Mattermost
::
Command
).
to
receive
(
:create
).
and_return
(
'token'
)
end
it
'redirects to the new page'
do
subject
service
=
project
.
services
.
last
expect
(
subject
).
to
redirect_to
(
edit_namespace_project_service_url
(
project
.
namespace
,
project
,
service
))
end
end
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