BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7529bbae
Commit
7529bbae
authored
Sep 02, 2016
by
Sean McGivern
Committed by
Alfredo Sumaran
Oct 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JSON Schema
parent
98dd958d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
0 deletions
+141
-0
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+4
-0
conflicts.json
spec/fixtures/api/schemas/conflicts.json
+137
-0
No files found.
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
7529bbae
...
@@ -597,6 +597,10 @@ describe Projects::MergeRequestsController do
...
@@ -597,6 +597,10 @@ describe Projects::MergeRequestsController do
format:
'json'
format:
'json'
end
end
it
'matches the schema'
do
expect
(
response
).
to
match_response_schema
(
'conflicts'
)
end
it
'includes meta info about the MR'
do
it
'includes meta info about the MR'
do
expect
(
json_response
[
'commit_message'
]).
to
include
(
'Merge branch'
)
expect
(
json_response
[
'commit_message'
]).
to
include
(
'Merge branch'
)
expect
(
json_response
[
'commit_sha'
]).
to
match
(
/\h{40}/
)
expect
(
json_response
[
'commit_sha'
]).
to
match
(
/\h{40}/
)
...
...
spec/fixtures/api/schemas/conflicts.json
0 → 100644
View file @
7529bbae
{
"type"
:
"object"
,
"required"
:
[
"commit_message"
,
"commit_sha"
,
"source_branch"
,
"target_branch"
,
"files"
],
"properties"
:
{
"commit_message"
:
{
"type"
:
"string"
},
"commit_sha"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9a-f]{40}$"
},
"source_branch"
:
{
"type"
:
"string"
},
"target_branch"
:
{
"type"
:
"string"
},
"files"
:
{
"type"
:
"array"
,
"items"
:
{
"oneOf"
:
[
{
"$ref"
:
"#/definitions/conflict-text-with-sections"
},
{
"$ref"
:
"#/definitions/conflict-text-for-editor"
}
]
}
}
},
"definitions"
:
{
"conflict-base"
:
{
"type"
:
"object"
,
"required"
:
[
"old_path"
,
"new_path"
,
"blob_icon"
,
"blob_path"
],
"properties"
:
{
"old_path"
:
{
"type"
:
"string"
},
"new_path"
:
{
"type"
:
"string"
},
"blob_icon"
:
{
"type"
:
"string"
},
"blob_path"
:
{
"type"
:
"string"
}
}
},
"conflict-text-for-editor"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/conflict-base"
},
{
"type"
:
"object"
,
"required"
:
[
"type"
,
"content_path"
],
"properties"
:
{
"type"
:
{
"type"
:
{
"enum"
:
[
"text-editor"
]}},
"content_path"
:
{
"type"
:
"string"
}
}
}
]
},
"conflict-text-with-sections"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/conflict-base"
},
{
"type"
:
"object"
,
"required"
:
[
"type"
,
"content_path"
,
"sections"
],
"properties"
:
{
"type"
:
{
"type"
:
{
"enum"
:
[
"text"
]}},
"content_path"
:
{
"type"
:
"string"
},
"sections"
:
{
"type"
:
"array"
,
"items"
:
{
"oneOf"
:
[
{
"$ref"
:
"#/definitions/section-context"
},
{
"$ref"
:
"#/definitions/section-conflict"
}
]
}
}
}
}
]
},
"section-base"
:
{
"type"
:
"object"
,
"required"
:
[
"conflict"
,
"lines"
],
"properties"
:
{
"conflict"
:
{
"type"
:
"boolean"
},
"lines"
:
{
"type"
:
"array"
,
"items"
:
{
"type"
:
"object"
,
"required"
:
[
"old_line"
,
"new_line"
,
"text"
,
"rich_text"
],
"properties"
:
{
"type"
:
{
"type"
:
"string"
},
"old_line"
:
{
"type"
:
"string"
},
"new_line"
:
{
"type"
:
"string"
},
"text"
:
{
"type"
:
"string"
},
"rich_text"
:
{
"type"
:
"string"
}
}
}
}
}
},
"section-context"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/section-base"
},
{
"type"
:
"object"
,
"properties"
:
{
"conflict"
:
{
"enum"
:
[
false
]}
}
}
]
},
"section-conflict"
:
{
"allOf"
:
[
{
"$ref"
:
"#/definitions/section-base"
},
{
"type"
:
"object"
,
"required"
:
[
"id"
],
"properties"
:
{
"conflict"
:
{
"enum"
:
[
true
]},
"id"
:
{
"type"
:
"string"
}
}
}
]
}
}
}
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