Commit d9823a42 authored by James Lopez's avatar James Lopez

Added error entities

parent 73df7adb
# frozen_string_literal: true
module EE
module Gitlab
module Scim
class Error < EE::Gitlab::Scim::NotFound
def status
409
end
end
end
end
end
# frozen_string_literal: true
module EE
module Gitlab
module Scim
class NotFound < Grape::Entity
expose :schemas
expose :detail, safe: true
expose :status
private
DEFAULT_SCHEMA = 'urn:ietf:params:scim:api:messages:2.0:Error'
def schemas
[DEFAULT_SCHEMA]
end
def status
404
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ::EE::Gitlab::Scim::Error do
let(:params) { { detail: 'error' } }
let(:entity) do
described_class.new(params)
end
subject { entity.as_json }
it 'contains the schemas' do
expect(subject[:schemas]).not_to be_empty
end
it 'contains the detail' do
expect(subject[:detail]).to eq(params[:detail])
end
it 'contains the status' do
expect(subject[:status]).to eq(409)
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ::EE::Gitlab::Scim::NotFound do
let(:entity) do
described_class.new({})
end
subject { entity.as_json }
it 'contains the schemas' do
expect(subject[:schemas]).not_to be_empty
end
it 'contains the detail' do
expect(subject[:detail]).to be_nil
end
it 'contains the status' do
expect(subject[:status]).to eq(404)
end
end
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