Sha256: d8d180ff1460814ba5e039fa8fcf4de56dab348204f2965710c70e26f08be27b
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' RSpec.describe 'Mapping domain models to Resource objects' do include_context 'fixtures' subject { mapper.call(john) } let(:mapper) { FriendMapper.new(policy: Yaks::DefaultPolicy.new, env: {}) } it { should be_a Yaks::Resource } its(:type) { should eql 'friend' } its(:attributes) { should eql(id: 1, name: 'john') } its(:links) { should eql [ Yaks::Resource::Link.new(:copyright, '/api/copyright/2024', {}) ] } its(:subresources) { should eq( "rel:src=friend&dest=pet_peeve" => Yaks::Resource.new(type:'pet_peeve', attributes: {id: 4, type: 'parsing with regexps'}), "rel:src=friend&dest=pets" => Yaks::CollectionResource.new( type: 'pet', members: [ Yaks::Resource.new(type: 'pet', attributes: {:id => 2, :species => "dog", :name => "boingboing"}), Yaks::Resource.new(type: 'pet', attributes: {:id => 3, :species => "cat", :name => "wassup"}) ], members_rel: 'rel:src=collection&dest=pets' ) ) } end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yaks-0.4.1 | spec/integration/map_to_resource_spec.rb |
yaks-0.4.0 | spec/integration/map_to_resource_spec.rb |