Sha256: 26170f52a382986220a6c5e900e383567f2ef728a5c65205b8c28bcc18643b9f

Contents?: true

Size: 1.72 KB

Versions: 5

Compression:

Stored size: 1.72 KB

Contents

# encoding: utf-8
require_relative '../spec_helper'

describe '/domain-types/:type/collections/:collection' do
  before(:all) do
    RestfulObjects::DomainModel.current.reset
  end

  it 'should generate a collection description representation' do
    class CollectionTest
      include RestfulObjects::Object
      collection :items, 'ItemClass', friendly_name: 'item collection', description: 'a collection description'
    end

    expected = {
      'id' => 'items',
      'friendlyName' => 'item collection',
      'description' => 'a collection description',
      'memberOrder' => 1,
      'links' => [
        { 'rel' => 'self',
          'href' => 'http://localhost/domain-types/CollectionTest/collections/items',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/collection-description"',
          'method' => 'GET' },
        { 'rel' => 'up',
          'href' => 'http://localhost/domain-types/CollectionTest',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' },
        { 'rel' => 'urn:org.restfulobjects:rels/return-type',
          'href' => 'http://localhost/domain-types/list',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' },
        { 'rel' => 'urn:org.restfulobjects:rels/element-type',
          'href' => 'http://localhost/domain-types/ItemClass',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' }
      ],
      'extensions' => wildcard_matcher
    }

    get '/domain-types/CollectionTest/collections/items'
    last_response.body.should match_json_expression expected
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
restful_objects-0.0.7 spec/integration/domain-types_collections_spec.rb
restful_objects-0.0.6 spec/integration/domain-types_collections_spec.rb
restful_objects-0.0.5 spec/integration/domain-types_collections_spec.rb
restful_objects-0.0.4 spec/integration/domain-types_collections_spec.rb
restful_objects-0.0.3 spec/integration/domain-types_collections_spec.rb