Sha256: 95e78bb895a8e7ba3e0b498f2c61c83eef3760294b45a1cd1e9e096d625d2c7d

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'
require 'restclient'

describe "G5K::Api" do
  
  it "should find the api if the api name is a string" do
    db_api = mock('restclient resource')
    G5K::Api.registered_apis = {:db => db_api}
    G5K::Api.select('db').should == db_api
  end
  it "should find the api if the api name is a symbol" do
    db_api = mock('restclient resource')
    G5K::Api.registered_apis = {'db' => db_api}
    G5K::Api.select(:db).should == db_api
  end
  it "should raise an ArgumentError if the API is not registered" do
    db_api = mock('restclient resource')
    G5K::Api.registered_apis = {'db' => db_api}
    lambda{G5K::Api.select(:whatever)}.should raise_error ArgumentError
  end
  it "should add the version and the URI complement at the end of the URI if they are given" do
    db_api = RestClient::Resource.new('https://localhost:4444')
    G5K::Api.registered_apis = {'db' => db_api}
    G5K::Api.select(:db, '1.0-stable', '/sites/rennes').url.should == 'https://localhost:4444/1.0-stable/sites/rennes'    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cryx-g5k-0.2.10 spec/g5k_spec.rb
cryx-g5k-0.2.11 spec/g5k_spec.rb
cryx-g5k-0.2.7 spec/g5k_spec.rb
cryx-g5k-0.2.8 spec/g5k_spec.rb
cryx-g5k-0.2.9 spec/g5k_spec.rb