Commit 6e99b82
Changed files (1)
spec
scim
kit
spec/scim/kit/v2/resource_type_spec.rb
@@ -1,26 +1,25 @@
# frozen_string_literal: true
RSpec.describe Scim::Kit::V2::ResourceType do
- subject { described_class.new(location: location) }
+ subject do
+ described_class.build(location: location) do |x|
+ x.id = 'Group'
+ x.description = 'Group'
+ x.endpoint = 'https://www.example.org/scim/v2/groups'
+ x.name = 'Group'
+ x.schema = Scim::Kit::V2::Schema::GROUP
+ end
+ end
let(:location) { FFaker::Internet.uri('https') }
- let(:hash) { JSON.parse(subject.to_json, symbolize_names: true) }
-
- before do
- subject.id = 'Group'
- subject.description = 'Group'
- subject.endpoint = 'https://www.example.org/scim/v2/groups'
- subject.name = 'Group'
- subject.schema = Scim::Kit::V2::Schema::GROUP
- end
- specify { expect(hash[:meta][:location]).to eql(location) }
- specify { expect(hash[:meta][:resourceType]).to eql('ResourceType') }
- specify { expect(hash[:schemas]).to match_array([Scim::Kit::V2::Schema::RESOURCE_TYPE]) }
- specify { expect(hash[:id]).to eql('Group') }
- specify { expect(hash[:description]).to eql(subject.description) }
- specify { expect(hash[:endpoint]).to eql(subject.endpoint) }
- specify { expect(hash[:name]).to eql(subject.name) }
- specify { expect(hash[:schema]).to eql(subject.schema) }
- specify { expect(hash[:schemaExtensions]).to match_array([]) }
+ specify { expect(subject.to_h[:meta][:location]).to eql(location) }
+ specify { expect(subject.to_h[:meta][:resourceType]).to eql('ResourceType') }
+ specify { expect(subject.to_h[:schemas]).to match_array([Scim::Kit::V2::Schema::RESOURCE_TYPE]) }
+ specify { expect(subject.to_h[:id]).to eql('Group') }
+ specify { expect(subject.to_h[:description]).to eql(subject.description) }
+ specify { expect(subject.to_h[:endpoint]).to eql(subject.endpoint) }
+ specify { expect(subject.to_h[:name]).to eql(subject.name) }
+ specify { expect(subject.to_h[:schema]).to eql(subject.schema) }
+ specify { expect(subject.to_h[:schemaExtensions]).to match_array([]) }
end