Sha256: 85b1ca94b11eaab77fe46b2ae47abda575787f4942f69e88bf0655f98a5bcbe5

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

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

describe "Session" do
  describe "when creating, .create" do
    it "should be cool when supplying an api key" do
      OldBill::Session.create(:username => ENV["OLD_BILL_USERNAME"], :password => ENV["OLD_BILL_PASSWORD"])
    end
    
    it "should have the defaults" do
      session = OldBill::Session.create(:username => ENV["OLD_BILL_USERNAME"], :password => ENV["OLD_BILL_PASSWORD"])
      session.server.should == "policeapi2.rkh.co.uk/api"
      session.api_version.should == 2
      session.logging.should be_false
      session.caching.should be_true
    end
    
    it "should allow defaults to be changed when creating" do
      session = OldBill::Session.create(:username => ENV["OLD_BILL_USERNAME"], :password => ENV["OLD_BILL_PASSWORD"], :api_version => 3, :logging => false, :server => "beans")
      session.server.should == "beans"
      session.logging.should be_false
      session.api_version.should == 3
    end
    
    it "should raise Argument error if no api key is supplied; with message 'need API to save the planet!'" do
      lambda{OldBill::Session.create}.should raise_error(ArgumentError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oldbill-0.0.3 spec/session/create_spec.rb
oldbill-0.0.2 spec/session/create_spec.rb
oldbill-0.0.1 spec/session/create_spec.rb