Sha256: 0877b44e60aae67b49d73e6a88a005ff81ae57e7a72396206450801cd4b0984a

Contents?: true

Size: 742 Bytes

Versions: 10

Compression:

Stored size: 742 Bytes

Contents

require 'spec_helper'

describe 'Client' do
  before :each do
    Goodreads.reset_configuration
  end
  
  it 'raises Goodreads::ConfigurationError if API key was not provided' do
    client = Goodreads::Client.new
    
    proc { client.book_by_isbn('0307463745') }.
      should raise_error Goodreads::ConfigurationError, 'API key required.'
  end
    
  it 'raises Goodreads::Unauthorized if API key is not valid' do
    client = Goodreads::Client.new(:api_key => 'INVALID_KEY')
    
    stub_request(:get, "http://www.goodreads.com/book/isbn?format=xml&isbn=054748250711&key=INVALID_KEY").
      to_return(:status => 401)
      
    proc { client.book_by_isbn('054748250711') }.
      should raise_error Goodreads::Unauthorized
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
goodreads-0.4.3 spec/authentication_spec.rb
goodreads-0.4.2 spec/authentication_spec.rb
goodreads-0.4.1 spec/authentication_spec.rb
goodreads-0.4.0 spec/authentication_spec.rb
goodreads-0.3.0 spec/authentication_spec.rb
goodreads_17up-0.2.2 spec/authentication_spec.rb
goodreads-0.2.2 spec/authentication_spec.rb
goodreads_17up-0.2.1 spec/authentication_spec.rb
goodreads-0.2.1 spec/authentication_spec.rb
goodreads-0.2.0 spec/authentication_spec.rb