Sha256: 1819bf19ee4b13e8dcd0250b36393fa01831a668d8803017d11d90326400ed6b

Contents?: true

Size: 1.9 KB

Versions: 9

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

module Chargify2
  describe Client do
    let(:client) { Client.new(valid_client_credentials) }
    
    it "holds an api_id when passed to .new in the 'api_id' key" do
      client = Client.new('api_id' => "myid")
      client.api_id.should == 'myid'
    end

    it "holds an api_id when passed to .new in the :api_id key" do
      client = Client.new(:api_id => "myid")
      client.api_id.should == 'myid'
    end

    it "holds an api_password when passed to .new in the 'api_password' key" do
      client = Client.new('api_password' => "mypass")
      client.api_password.should == 'mypass'
    end

    it "holds an api_password when passed to .new in the :api_password key" do
      client = Client.new(:api_password => "mypass")
      client.api_password.should == 'mypass'
    end

    it "holds an api_secret when passed to .new in the 'api_secret' key" do
      client = Client.new('api_secret' => "mysecret")
      client.api_secret.should == 'mysecret'
    end

    it "holds an api_secret when passed to .new in the :api_secret key" do
      client = Client.new(:api_secret => "mysecret")
      client.api_secret.should == 'mysecret'
    end
  
    it "has a default base_uri of 'https://api.chargify.com/api/v2'" do
      client = Client.new(valid_client_credentials)
      client.base_uri.should == 'https://api.chargify.com/api/v2'
    end
    
    it "allows the setting of a different base_uri via initialization params" do
      client = Client.new(valid_client_credentials.merge(:base_uri => "http://example.com"))
      client.base_uri.should == 'http://example.com'
    end
    
    it "gives access to a pre-configured Direct instance through #direct" do
      direct = client.direct
      
      direct.should be_a(Direct)
      direct.client.should == client
    end
    
    it "accesses a CallResource through #calls" do
      calls = client.calls.should be_a(CallResource)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
chargify2-0.2.8 spec/client_spec.rb
chargify2-0.2.7 spec/client_spec.rb
chargify2-0.2.6 spec/client_spec.rb
chargify2-0.2.5 spec/client_spec.rb
chargify2-0.2.4 spec/client_spec.rb
chargify2-0.2.2 spec/client_spec.rb
chargify2-0.2.1 spec/client_spec.rb
chargify2-0.2.0 spec/client_spec.rb
chargify2-0.1.0 spec/client_spec.rb