Sha256: aa5e506b0294e666f3c1d11b0b69b9e0fc62352cca84370278f9b55c8fb014b5

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

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

describe RestfulObjects::TypeList do
  before(:all) do
    RestfulObjects::DomainModel.current.reset

    class DomainObject
      include RestfulObjects::Object
    end
  end

  it 'should generate domain types list resource' do
    expected = {
      'links' => [
        { 'rel' => 'self',
          'href' => 'http://localhost/domain-types',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/type-list"',
          'method' => 'GET' },
        { 'rel' => 'up',
          'href' => 'http://localhost/',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/homepage"',
          'method' => 'GET' }
      ],
      'value' => [
        { 'rel' => 'urn:org.restfulobjects:rels/domain-type',
          'href' => "http://localhost/domain-types/#{DomainObject}",
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' }
      ],
      'extensions' => {}
    }.to_json

    RestfulObjects::DomainModel.current.types.get_representation
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restful_objects-0.0.2 spec/unit/type_list_spec.rb