Sha256: ae8ca739ca4a91e081a43c86f91630033cbc32aee1026413654ebb964e968870

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 have destroy/show/update for all instances of the Resource class" do
      resource = RightApi::Resource.process(@client, 'session', '/api/session')
      resource.api_methods.sort.should == [:destroy, :show, :update]
    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.9 spec/resource_spec.rb
right_api_client-1.5.8 spec/resource_spec.rb
right_api_client-1.5.7 spec/resource_spec.rb
right_api_client-1.5.6 spec/resource_spec.rb