Sha256: e05e5fedac6df62e9186108281ebfa1c55ed2101c225d058608824838e0ce3a7

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

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

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

  it 'should generate an action description representation' do
    class ActionTest
      include RestfulObjects::Object
      action :do_something, return_type: :int, friendly_name: 'do something!', description: 'description of something'
    end

    expected = {
      'id' => 'do_something',
      'friendlyName' => 'do something!',
      'description' => 'description of something',
      'hasParams' => false,
      'memberOrder' => :integer,
      'parameters' => {},
      'links' => [
        { 'rel' => 'self',
          'href' => 'http://localhost/domain-types/ActionTest/actions/do_something',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/action-description"',
          'method' => 'GET' },
        { 'rel' => 'up',
          'href' => 'http://localhost/domain-types/ActionTest',
          '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/int',
          'type' => 'application/json;profile="urn:org.restfulobjects:repr-types/domain-type"',
          'method' => 'GET' }
      ]
    }

    get '/domain-types/ActionTest/actions/do_something'

    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_actions_spec.rb
restful_objects-0.0.6 spec/integration/domain-types_actions_spec.rb
restful_objects-0.0.5 spec/integration/domain-types_actions_spec.rb
restful_objects-0.0.4 spec/integration/domain-types_actions_spec.rb
restful_objects-0.0.3 spec/integration/domain-types_actions_spec.rb