Sha256: e59924a8a59e7bea7cc0d90af9d99a840d52bd0f8cf6fa2a5593bffdcfba1176

Contents?: true

Size: 983 Bytes

Versions: 4

Compression:

Stored size: 983 Bytes

Contents

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

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

    it "Should have the required methods for instances of the Resource class" do
      resource = RightApi::Resource.process(@client, 'deployment', '/api/deployments/1')
      resource.api_methods.sort.collect{|s| s.to_s}.should == ["destroy", "show", "update"]
    end

    it "Should not have destroy/show/update for instances of the Resource class that do not support them" do
      resource = RightApi::Resource.process(@client, 'session', '/api/session')
      resource.api_methods.sort.should == []
    end

    it "Should have 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

4 entries across 4 versions & 1 rubygems

Version Path
right_api_client-1.5.5 spec/resource_spec.rb
right_api_client-1.5.4 spec/resource_spec.rb
right_api_client-1.5.3 spec/resource_spec.rb
right_api_client-1.5.2 spec/resource_spec.rb