Sha256: e2e171dca4497b22478398c4357e72cccd0f54047916876587c152dbf0ec144c

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe AngellistApi::API do

  describe "#initialize" do
    context "without passing new options" do
      it "uses the default options" do
        api = AngellistApi::API.new
        AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |valid_key|
          api.send(valid_key).should == AngellistApi.options[valid_key]
        end
      end
    end

    context "while passing custom options" do
      it "uses the new options" do
        key_to_overwrite = AngellistApi.options.keys.first
        overwrite_value  = "NEW VALUE!!"

        api = AngellistApi::API.new(key_to_overwrite => overwrite_value)
        AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |valid_key|
          expected_value = valid_key == key_to_overwrite ? overwrite_value : AngellistApi.options[valid_key]
          api.send(valid_key).should == expected_value
        end
      end
    end
  end

  describe "configuration" do
    let(:api) { AngellistApi::API.new }

    AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |config_key|
      it "allows the value of #{config_key} to be set" do
        expect { api.send("#{config_key}=", "SOME NEW VALUE") }.to_not raise_error
        api.send(config_key).should == "SOME NEW VALUE"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
angellist_api-1.1.0 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.7 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.6 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.5 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.4 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.3 spec/unit/lib/angellist_api/api_spec.rb
angellist_api-1.0.2 spec/unit/lib/angellist_api/api_spec.rb