Skip to content
Snippets Groups Projects
Unverified Commit 99a38a73 authored by Peter Leitzen's avatar Peter Leitzen
Browse files

Enhance and test JSON schema for deployments

parent 75723034
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -20,12 +20,35 @@
"name"
],
"properties": {
"name": { "type": "string" }
"name": { "type": "string" },
"ref_path": { "type": "string" }
},
"additionalProperties": false
},
"sha": { "type": "string" },
"tag": { "type": "boolean" }
"tag": { "type": "boolean" },
"user": {
"oneOf": [
{ "type": "null" },
{ "$ref": "entities/user.json" }
]
},
"commit": {
"oneOf": [
{ "type": "null" },
{ "$ref": "entities/commit.json" }
]
},
"deployable": {
"oneOf": [
{ "type": "null" },
{ "$ref": "job/job.json" }
]
},
"manual_actions": {
"type": "array",
"items": { "$ref": "job/job.json" }
}
},
"additionalProperties": false
}
Loading
Loading
@@ -17,11 +17,10 @@
"author": {
"oneOf": [
{ "type": "null" },
{ "type": "user.json" }
{ "$ref": "user.json" }
]
}
},
"additionalProperties": false
}
}
]
}
# frozen_string_literal: true
require 'spec_helper'
describe DeploymentSerializer do
set(:project) { create(:project, :repository) }
set(:user) { create(:user, email: project.commit.author_email) }
let(:resource) { create(:deployment, project: project, sha: project.commit.id) }
let(:serializer) { described_class.new(request) }
shared_examples 'json schema' do
let(:json_entity) { subject.as_json }
it 'matches deployment entity schema' do
expect(json_entity).to match_schema('deployment')
end
end
describe '#represent' do
subject { serializer.represent(resource) }
let(:request) { { project: project, current_user: user } }
it_behaves_like 'json schema'
end
describe '#represent_concise' do
subject { serializer.represent_concise(resource) }
let(:request) { { project: project } }
it_behaves_like 'json schema'
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment