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
bbafb853
Commit
bbafb853
authored
Jun 05, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing tests around rendering invalid merge requests (HTML+JSON)
parent
a34666e6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+20
-0
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+6
-0
No files found.
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
bbafb853
...
@@ -80,6 +80,16 @@ describe Projects::MergeRequestsController do
...
@@ -80,6 +80,16 @@ describe Projects::MergeRequestsController do
))
))
end
end
end
end
context
"that is invalid"
do
let
(
:merge_request
)
{
create
(
:invalid_merge_request
,
target_project:
project
,
source_project:
project
)
}
it
"renders merge request page"
do
go
(
format: :html
)
expect
(
response
).
to
be_success
end
end
end
end
describe
'as json'
do
describe
'as json'
do
...
@@ -106,6 +116,16 @@ describe Projects::MergeRequestsController do
...
@@ -106,6 +116,16 @@ describe Projects::MergeRequestsController do
expect
(
response
).
to
match_response_schema
(
'entities/merge_request_widget'
)
expect
(
response
).
to
match_response_schema
(
'entities/merge_request_widget'
)
end
end
end
end
context
"that is invalid"
do
let
(
:merge_request
)
{
create
(
:invalid_merge_request
,
target_project:
project
,
source_project:
project
)
}
it
"renders merge request page"
do
go
(
format: :json
)
expect
(
response
).
to
be_success
end
end
end
end
describe
"as diff"
do
describe
"as diff"
do
...
...
spec/factories/merge_requests.rb
View file @
bbafb853
...
@@ -54,6 +54,11 @@ FactoryBot.define do
...
@@ -54,6 +54,11 @@ FactoryBot.define do
state
:opened
state
:opened
end
end
trait
:invalid
do
source_branch
"feature_one"
target_branch
"feature_two"
end
trait
:locked
do
trait
:locked
do
state
:locked
state
:locked
end
end
...
@@ -98,6 +103,7 @@ FactoryBot.define do
...
@@ -98,6 +103,7 @@ FactoryBot.define do
factory
:merged_merge_request
,
traits:
[
:merged
]
factory
:merged_merge_request
,
traits:
[
:merged
]
factory
:closed_merge_request
,
traits:
[
:closed
]
factory
:closed_merge_request
,
traits:
[
:closed
]
factory
:reopened_merge_request
,
traits:
[
:opened
]
factory
:reopened_merge_request
,
traits:
[
:opened
]
factory
:invalid_merge_request
,
traits:
[
:invalid
]
factory
:merge_request_with_diffs
,
traits:
[
:with_diffs
]
factory
:merge_request_with_diffs
,
traits:
[
:with_diffs
]
factory
:merge_request_with_diff_notes
do
factory
:merge_request_with_diff_notes
do
after
(
:create
)
do
|
mr
|
after
(
:create
)
do
|
mr
|
...
...
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