Sha256: 02e7cebc9859cca9e42ac0bfd7099d9c991cf5e70ff5bb9af31e77dbccf7e1e6

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 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

1 entries across 1 versions & 1 rubygems

Version Path
restful_objects-0.0.2 spec/integration/domain-types_collections_spec.rb