Sha256: 43006ad14113eeb2aa15ad3c8b221a4f6729f4ec1fc2747360daf0896fabf3e2
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe AngellistApi::Configuration do class ExtendedClass; extend AngellistApi::Configuration; end class IncludedClass; include AngellistApi::Configuration; end describe "#extended" do it "should have all configuration variables set to the default values by default" do AngellistApi::Configuration::VALID_OPTIONS_KEYS.each do |key| ExtendedClass.send(key).should == AngellistApi::Configuration.const_get("DEFAULT_#{key.to_s.upcase}") end end end describe "#configure" do it "should allow configuration variables to be set in a block" do object = IncludedClass.new object.configure do |o| o.access_token = "my oauth token" end object.access_token.should == "my oauth token" end end describe "#options" do it "should return a hash of all configuration options" do object = IncludedClass.new config = { :access_token => "123-token" } config.each { |k,v| object.send("#{k.to_s}=", v) } config.each { |k,v| object.options[k].should == v } end end describe "#reset" do it "should set all config variables to the defaults" do object = IncludedClass.new AngellistApi::Configuration::VALID_OPTIONS_KEYS.each_with_index do |key, i| object.send("#{key}=", i) object.send(key).should == i end object.reset AngellistApi::Configuration::VALID_OPTIONS_KEYS.each_with_index do |key, i| object.send(key).should == AngellistApi::Configuration.const_get("DEFAULT_#{key.to_s.upcase}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
angellist_api-1.0.1 | spec/lib/angellist_api/configuration_spec.rb |
angellist_api-0.1.2 | spec/lib/angellist_api/configuration_spec.rb |