Sha256: 0d4de9c8b430dbb8304689a3b1b5d9f89f0f6c1d1bee9dea4534c2e7e8bea486

Contents?: true

Size: 938 Bytes

Versions: 8

Compression:

Stored size: 938 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe RightApi::Resource do
  context "given a logged in RightScale user" do
    before(:each) do
      given_user_facing_client
    end

    it "has the required methods for instances of the Resource class" do
      resource = RightApi::Resource.process(@client, 'deployment', '/api/deployments/1')
      resource.api_methods.sort.map(&:to_s).should == %w[ destroy show update ]
    end

    it "has destroy/show/update for all instances of the Resource class" do
      resource = RightApi::Resource.process(@client, 'session', '/api/session')
      resource.api_methods.sort.map(&:to_s).should == %w[ destroy show update ]
    end

    it "has an array of ResourceDetail instances for index calls" do
      resources = RightApi::Resource.process(@client, 'deployment', '/api/deployments', [{}])
      resources.first.class.should == RightApi::ResourceDetail
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
right_api_client-1.5.19 spec/unit/resource_spec.rb
right_api_client-1.5.18 spec/unit/resource_spec.rb
right_api_client-1.5.17 spec/unit/resource_spec.rb
right_api_client-1.5.16 spec/unit/resource_spec.rb
right_api_client-1.5.15 spec/unit/resource_spec.rb
right_api_client-1.5.14 spec/unit/resource_spec.rb
right_api_client-1.5.13 spec/unit/resource_spec.rb
right_api_client-1.5.12 spec/unit/resource_spec.rb