Sha256: 0f699e5b62797d21481e754a7f56aa27308ec1b96fee0bc1fb79db2a37093c62

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe "Exchange::ExternalAPI::Configuration" do
  
  subject { Exchange::ExternalAPI::Configuration.instance }
  
  describe "attr_readers" do
    [:subclass, :retries, :app_id].each do |reader|
      it "should respond to #{reader}" do
        subject.should be_respond_to(reader)
      end
      it "should respond to #{reader}=" do
        subject.should be_respond_to(:"#{reader}=")
      end
    end
  end
  
  describe "subclass constantize" do
    it "should automatically constantize the subclass" do
      subject.subclass = :xavier_media
      
      subject.subclass.should == Exchange::ExternalAPI::XavierMedia
    end
  end
  
  describe "set" do
    before(:each) do
      @return = subject.set :subclass => :xavier_media, :retries => 55, :app_id => "KEY"
    end
    it "should set the options given" do
      subject.subclass.should == Exchange::ExternalAPI::XavierMedia
      subject.retries.should == 55
      subject.app_id.should == 'KEY'
    end
    it "should return self" do
      @return.should == subject
    end
  end
  
  describe "reset" do
    before(:each) do
      subject.set :subclass => :xavier_media, :retries => 55, :app_id => "KEY"
    end
    it "should restore the defaults" do
      subject.reset
      subject.subclass.should == Exchange::ExternalAPI::XavierMedia
      subject.retries.should == 5
      subject.app_id.should be_nil
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
exchange-0.12.0 spec/exchange/external_api/configuration_spec.rb
exchange-0.11.0 spec/exchange/external_api/configuration_spec.rb
exchange-0.10.2 spec/exchange/external_api/configuration_spec.rb
exchange-0.10.1 spec/exchange/external_api/configuration_spec.rb
exchange-0.10.0 spec/exchange/external_api/configuration_spec.rb
exchange-0.9.0 spec/exchange/external_api/configuration_spec.rb