Sha256: b18cb4360a029df4f6967abbd7552f449dcf6e077b845b21cb271901e1b9dddd

Contents?: true

Size: 1.43 KB

Versions: 8

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe 'Goodreads' do
  describe '.new' do
    it 'returns a new client instance' do
      Goodreads.new.should be_a Goodreads::Client
    end
  end

  describe '.configure' do
    it 'sets a global configuration options' do
      r = Goodreads.configure(:api_key => 'FOO', :api_secret => 'BAR')
      r.should be_a Hash
      r.should have_key(:api_key)
      r.should have_key(:api_secret)
      r[:api_key].should eql('FOO')
      r[:api_secret].should eql('BAR')
    end

    it 'raises ConfigurationError on invalid config parameter' do
      proc { Goodreads.configure(nil) }.
        should raise_error(ArgumentError, "Options hash required.")

      proc { Goodreads.configure('foo') }.
        should raise_error ArgumentError, "Options hash required."
    end
  end

  describe '.configuration' do
    before do
      Goodreads.configure(:api_key => 'FOO', :api_secret => 'BAR')
    end

    it 'returns global configuration options' do
      r = Goodreads.configuration
      r.should be_a Hash
      r.should have_key(:api_key)
      r.should have_key(:api_secret)
      r[:api_key].should eql('FOO')
      r[:api_secret].should eql('BAR')
    end
  end

  describe '.reset_configuration' do
    before do
      Goodreads.configure(:api_key => 'FOO', :api_secret => 'BAR')
    end

    it 'resets global configuration options' do
      Goodreads.reset_configuration
      Goodreads.configuration.should eql({})
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

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