Sha256: f872f992fe2648e195a6ff3bb927aac6b986338bec146c9ff37a54aaee588cab

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

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

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

  it 'should generate a property description representation' do
    class PropertyTest
      include RestfulObjects::Object
      property :name, :string, friendly_name: 'a friendly name', description: 'name description'
    end

    expected = {
      'id' => 'name',
      'friendlyName' => 'a friendly name',
      'description' => 'name description',
      'optional' => true,
      'memberOrder' => :integer,
      'links' => [
        { 'rel' => 'self',
          'href' => 'http://localhost/domain-types/PropertyTest/properties/name',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/property-description"',
          'method' => 'GET' },
        { 'rel' => 'up',
          'href' => 'http://localhost/domain-types/PropertyTest',
          '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/string',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' }
      ]
    }

    get '/domain-types/PropertyTest/properties/name'
    last_response.body.should match_json_expression expected
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
restful_objects-0.0.5 spec/integration/domain-types_properties_spec.rb
restful_objects-0.0.4 spec/integration/domain-types_properties_spec.rb
restful_objects-0.0.3 spec/integration/domain-types_properties_spec.rb