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
Jérome Perrin
gitlab-ce
Commits
8e8ec9d7
Commit
8e8ec9d7
authored
Jan 30, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ApiHelpers in merge request specs for API routes
parent
ac5b3ce0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+5
-11
No files found.
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
8e8ec9d7
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
MergeRequestsController
do
describe
Projects
::
MergeRequestsController
do
include
ApiHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
project
)
}
...
@@ -455,7 +457,7 @@ describe Projects::MergeRequestsController do
...
@@ -455,7 +457,7 @@ describe Projects::MergeRequestsController do
it
'renders the diffs template to a string'
do
it
'renders the diffs template to a string'
do
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_diffs'
)
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_diffs'
)
expect
(
JSON
.
parse
(
response
.
body
)
).
to
have_key
(
'html'
)
expect
(
json_response
).
to
have_key
(
'html'
)
end
end
end
end
...
@@ -494,7 +496,7 @@ describe Projects::MergeRequestsController do
...
@@ -494,7 +496,7 @@ describe Projects::MergeRequestsController do
it
'renders the diffs template to a string'
do
it
'renders the diffs template to a string'
do
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_diffs'
)
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_diffs'
)
expect
(
JSON
.
parse
(
response
.
body
)
).
to
have_key
(
'html'
)
expect
(
json_response
).
to
have_key
(
'html'
)
end
end
end
end
end
end
...
@@ -662,7 +664,7 @@ describe Projects::MergeRequestsController do
...
@@ -662,7 +664,7 @@ describe Projects::MergeRequestsController do
go
format:
'json'
go
format:
'json'
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_commits'
)
expect
(
response
).
to
render_template
(
'projects/merge_requests/show/_commits'
)
expect
(
JSON
.
parse
(
response
.
body
)
).
to
have_key
(
'html'
)
expect
(
json_response
).
to
have_key
(
'html'
)
end
end
end
end
end
end
...
@@ -687,8 +689,6 @@ describe Projects::MergeRequestsController do
...
@@ -687,8 +689,6 @@ describe Projects::MergeRequestsController do
format: :json
format: :json
end
end
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
it
'responds with a rendered HTML partial'
do
it
'responds with a rendered HTML partial'
do
expect
(
response
)
expect
(
response
)
.
to
render_template
(
'projects/merge_requests/show/_pipelines'
)
.
to
render_template
(
'projects/merge_requests/show/_pipelines'
)
...
@@ -703,8 +703,6 @@ describe Projects::MergeRequestsController do
...
@@ -703,8 +703,6 @@ describe Projects::MergeRequestsController do
end
end
describe
'GET conflicts'
do
describe
'GET conflicts'
do
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
context
'when the conflicts cannot be resolved in the UI'
do
context
'when the conflicts cannot be resolved in the UI'
do
before
do
before
do
allow_any_instance_of
(
Gitlab
::
Conflict
::
Parser
).
allow_any_instance_of
(
Gitlab
::
Conflict
::
Parser
).
...
@@ -801,8 +799,6 @@ describe Projects::MergeRequestsController do
...
@@ -801,8 +799,6 @@ describe Projects::MergeRequestsController do
end
end
describe
'GET conflict_for_path'
do
describe
'GET conflict_for_path'
do
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
def
conflict_for_path
(
path
)
def
conflict_for_path
(
path
)
get
:conflict_for_path
,
get
:conflict_for_path
,
namespace_id:
merge_request_with_conflicts
.
project
.
namespace
.
to_param
,
namespace_id:
merge_request_with_conflicts
.
project
.
namespace
.
to_param
,
...
@@ -857,7 +853,6 @@ describe Projects::MergeRequestsController do
...
@@ -857,7 +853,6 @@ describe Projects::MergeRequestsController do
end
end
context
'POST resolve_conflicts'
do
context
'POST resolve_conflicts'
do
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let!
(
:original_head_sha
)
{
merge_request_with_conflicts
.
diff_head_sha
}
let!
(
:original_head_sha
)
{
merge_request_with_conflicts
.
diff_head_sha
}
def
resolve_conflicts
(
files
)
def
resolve_conflicts
(
files
)
...
@@ -1055,7 +1050,6 @@ describe Projects::MergeRequestsController do
...
@@ -1055,7 +1050,6 @@ describe Projects::MergeRequestsController do
let!
(
:forked
)
{
create
(
:project
)
}
let!
(
:forked
)
{
create
(
:project
)
}
let!
(
:environment
)
{
create
(
:environment
,
project:
forked
)
}
let!
(
:environment
)
{
create
(
:environment
,
project:
forked
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
sha:
forked
.
commit
.
id
,
ref:
'master'
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
sha:
forked
.
commit
.
id
,
ref:
'master'
)
}
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:merge_request
)
do
let
(
:merge_request
)
do
...
...
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