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
7cce1ef3
Commit
7cce1ef3
authored
May 05, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checks for :success instead "success"
parent
ac3e9c2a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
app/controllers/projects/related_issues_controller.rb
app/controllers/projects/related_issues_controller.rb
+1
-1
spec/controllers/projects/related_issues_controller_spec.rb
spec/controllers/projects/related_issues_controller_spec.rb
+2
-2
No files found.
app/controllers/projects/related_issues_controller.rb
View file @
7cce1ef3
...
...
@@ -11,7 +11,7 @@ module Projects
opts
=
{
issue_references:
params
[
:issue_references
]
}
result
=
RelatedIssues
::
CreateService
.
new
(
issue
,
current_user
,
opts
).
execute
if
result
[
'status'
]
==
'success'
if
result
[
'status'
]
==
:success
render
json:
{
result:
result
,
issues:
issues
},
status:
result
[
'http_status'
]
else
render
json:
{
result:
result
},
status:
result
[
'http_status'
]
...
...
spec/controllers/projects/related_issues_controller_spec.rb
View file @
7cce1ef3
...
...
@@ -34,7 +34,7 @@ describe Projects::RelatedIssuesController, type: :controller do
describe
'POST #create'
do
let
(
:service
)
{
double
(
RelatedIssues
::
CreateService
,
execute:
service_response
)
}
let
(
:list_service
)
{
double
(
RelatedIssues
::
ListService
,
execute:
list_service_response
)
}
let
(
:service_response
)
{
{
'message'
=>
'yay'
,
'status'
=>
'success'
}
}
let
(
:service_response
)
{
{
'message'
=>
'yay'
,
'status'
=>
:success
}
}
let
(
:list_service_response
)
{
[{
'foo'
=>
'bar'
}]
}
let
(
:issue_references
)
{
double
}
let
(
:user_role
)
{
:developer
}
...
...
@@ -63,7 +63,7 @@ describe Projects::RelatedIssuesController, type: :controller do
context
'with success'
do
it
'returns success JSON'
do
is_expected
.
to
have_http_status
(
200
)
expect
(
json_response
).
to
eq
(
'result'
=>
service_response
,
expect
(
json_response
).
to
eq
(
'result'
=>
{
'message'
=>
'yay'
,
'status'
=>
'success'
}
,
'issues'
=>
list_service_response
)
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