Sha256: f8b98ffa6648437a15dc47a45ef5ea8e25bde0e5397788c0ca16e4b0e83c302b

Contents?: true

Size: 1.72 KB

Versions: 24

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe Socialcastr do
  context 'configuration' do
    context 'called without a block' do
      before :each do
        @config = Socialcastr.configuration
      end
      it 'should return a Socialcastr::Configuration instance' do
        @config.class.should == Socialcastr::Configuration
      end
    end
    context 'called with a block' do
      before :each do
        @called = nil
        Socialcastr.configuration do |config|
          @called = config
        end
      end
      it 'should call the block' do
        @called.should_not be_nil
      end
      it 'should pass a configuration instance to the block' do
        @called.equal?(Socialcastr::Configuration.instance).should be_true
      end
      context 'pointing to a yaml ile' do
        before :each do
          Socialcastr.configuration do |config|
            config.config_file = File.join(File.dirname(__FILE__), 'fixtures', 'demo_config.yml')
          end
        end

        it 'should load the configuration attributes from the file' do
          Socialcastr.configuration.username.should == "file_demo"
          Socialcastr.configuration.password.should == "password"
          Socialcastr.configuration.domain.should == "demo.socialcast.com"
        end
      end
    end
  end

  context 'api' do
    context 'called without having configured Socialcastr' do
      it 'should raise an error' do
        lambda { Socialcastr.api }.should raise_error
      end
    end
    context 'called after configuring Socialcastr' do
      before :each do
        configure_socialcastr
        @api = Socialcastr.api
      end
      it 'should return a new Socialcastr::API instance' do
        @api.class.should == Socialcastr::API
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
socialcastr-0.2.19 spec/socialcastr_spec.rb
socialcastr-0.2.18 spec/socialcastr_spec.rb
socialcastr-0.2.17 spec/socialcastr_spec.rb
socialcastr-0.2.16 spec/socialcastr_spec.rb
socialcastr-0.2.15 spec/socialcastr_spec.rb
socialcastr-0.2.14 spec/socialcastr_spec.rb
socialcastr-0.2.13 spec/socialcastr_spec.rb
socialcastr-0.2.12 spec/socialcastr_spec.rb
socialcastr-0.2.11 spec/socialcastr_spec.rb
socialcastr-0.2.10 spec/socialcastr_spec.rb
socialcastr-0.2.9 spec/socialcastr_spec.rb
socialcastr-0.2.8 spec/socialcastr_spec.rb
socialcastr-0.2.7 spec/socialcastr_spec.rb
socialcastr-0.2.6 spec/socialcastr_spec.rb
socialcastr-0.2.5 spec/socialcastr_spec.rb
socialcastr-0.2.4 spec/socialcastr_spec.rb
socialcastr-0.2.3 spec/socialcastr_spec.rb
socialcastr-0.2.2 spec/socialcastr_spec.rb
socialcastr-0.2.1 spec/socialcastr_spec.rb
socialcastr-0.2.0 spec/socialcastr_spec.rb