Commit cdae31c3 authored by Etienne Baqué's avatar Etienne Baqué

Fixed spec files and serializers based on review comments

Added iid to Milestone and Issue entities.
Adjusted rspec accordingly.
Added additionalProperties attribute to schemas.
parent 1e4cd02d
...@@ -6,6 +6,7 @@ class EvidenceIssueEntity < Grape::Entity ...@@ -6,6 +6,7 @@ class EvidenceIssueEntity < Grape::Entity
expose :description expose :description
expose :author, using: EvidenceAuthorEntity expose :author, using: EvidenceAuthorEntity
expose :state expose :state
expose :iid
expose :confidential expose :confidential
expose :created_at expose :created_at
expose :due_date expose :due_date
......
...@@ -5,6 +5,7 @@ class EvidenceMilestoneEntity < Grape::Entity ...@@ -5,6 +5,7 @@ class EvidenceMilestoneEntity < Grape::Entity
expose :title expose :title
expose :description expose :description
expose :state expose :state
expose :iid
expose :created_at expose :created_at
expose :due_date expose :due_date
expose :issues, using: EvidenceIssueEntity expose :issues, using: EvidenceIssueEntity
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
class EvidenceReleaseEntity < Grape::Entity class EvidenceReleaseEntity < Grape::Entity
expose :id expose :id
expose :tag expose :tag, as: :tag_name
expose :name expose :name
expose :description expose :description
expose :created_at expose :created_at
......
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"id": { "type": "integer" }, "id": { "type": "integer" },
"name": { "type": "string" }, "name": { "type": "string" },
"email": { "type": "string" } "email": { "type": "string" }
} },
"additionalProperties": false
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"description", "description",
"author", "author",
"state", "state",
"iid",
"confidential", "confidential",
"created_at", "created_at",
"due_date" "due_date"
...@@ -16,8 +17,10 @@ ...@@ -16,8 +17,10 @@
"description": { "type": "string" }, "description": { "type": "string" },
"author": { "$ref": "author.json" }, "author": { "$ref": "author.json" },
"state": { "type": "string" }, "state": { "type": "string" },
"iid": { "type": "integer" },
"confidential": { "type": "boolean" }, "confidential": { "type": "boolean" },
"created_at": { "type": "date" }, "created_at": { "type": "date" },
"due_date": { "type": "date" } "due_date": { "type": "date" }
} },
"additionalProperties": false
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"title", "title",
"description", "description",
"state", "state",
"iid",
"created_at", "created_at",
"due_date", "due_date",
"issues" "issues"
...@@ -14,11 +15,13 @@ ...@@ -14,11 +15,13 @@
"title": { "type": "string" }, "title": { "type": "string" },
"description": { "type": "string" }, "description": { "type": "string" },
"state": { "type": "string" }, "state": { "type": "string" },
"iid": { "type": "integer" },
"created_at": { "type": "date" }, "created_at": { "type": "date" },
"due_date": { "type": "date" }, "due_date": { "type": "date" },
"issues": { "issues": {
"type": "array", "type": "array",
"items": { "$ref": "issue.json" } "items": { "$ref": "issue.json" }
} }
} },
"additionalProperties": false
} }
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"name": { "type": "string" }, "name": { "type": "string" },
"description": { "type": "string" }, "description": { "type": "string" },
"created_at": { "type": "date" } "created_at": { "type": "date" }
} },
"additionalProperties": false
} }
{ {
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://example.com/release.schema.json",
"type": "object", "type": "object",
"required": [ "required": [
"id", "id",
...@@ -22,5 +20,6 @@ ...@@ -22,5 +20,6 @@
"type": "array", "type": "array",
"items": { "$ref": "milestone.json" } "items": { "$ref": "milestone.json" }
} }
} },
"additionalProperties": false
} }
...@@ -8,6 +8,6 @@ describe EvidenceIssueEntity do ...@@ -8,6 +8,6 @@ describe EvidenceIssueEntity do
subject { entity.as_json } subject { entity.as_json }
it 'exposes the expected fields' do it 'exposes the expected fields' do
expect(subject.keys).to contain_exactly(:id, :title, :description, :author, :state, :confidential, :created_at, :due_date) expect(subject.keys).to contain_exactly(:id, :title, :description, :author, :state, :iid, :confidential, :created_at, :due_date)
end end
end end
...@@ -9,7 +9,7 @@ describe EvidenceMilestoneEntity do ...@@ -9,7 +9,7 @@ describe EvidenceMilestoneEntity do
subject { entity.as_json } subject { entity.as_json }
it 'exposes the expected fields' do it 'exposes the expected fields' do
expect(subject.keys).to contain_exactly(:id, :title, :description, :state, :created_at, :due_date, :issues) expect(subject.keys).to contain_exactly(:id, :title, :description, :state, :iid, :created_at, :due_date, :issues)
end end
context 'when there issues linked to this milestone' do context 'when there issues linked to this milestone' do
......
...@@ -9,7 +9,7 @@ describe EvidenceReleaseEntity do ...@@ -9,7 +9,7 @@ describe EvidenceReleaseEntity do
subject { entity.as_json } subject { entity.as_json }
it 'exposes the expected fields' do it 'exposes the expected fields' do
expect(subject.keys).to contain_exactly(:id, :tag, :name, :description, :created_at, :project, :milestones) expect(subject.keys).to contain_exactly(:id, :tag_name, :name, :description, :created_at, :project, :milestones)
end end
context 'when the release has milestones' do context 'when the release has milestones' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment