Sha256: 0acb054f9944dfbd815100e7f0d3bf5701c5bb9f99d180e07585ab738d8f3cdf

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

module Embedly
  describe Configuration do

    let(:config) { Configuration.new }

    describe "debug and logging" do
      let(:logger) { Logger.new(STDERR) }

      it "has debugger disabled by default" do
        config.should_not have_debug_enabled
      end

      it "has default logger level as error" do
        config.logger.level.should == Logger::ERROR
      end

      it "can enable debugging" do
        config.debug = true
        config.should have_debug_enabled
      end

      it "can disable debugging" do
        config.debug = false
        config.should_not have_debug_enabled
      end

      it "can change the logger" do
        config.logger = logger
        config.logger.should === logger
      end

      it "sets the logger level for the new logger" do
        config.debug  = true
        config.logger = logger
        config.logger.level.should == Logger::DEBUG
      end

      it "changes the logger level when enable debugging" do
        config.debug = true
        config.logger.level.should == Logger::DEBUG
      end
    end

    describe "setting options" do
      it "sets the api key" do
        config.key = 'my_api_key'
        config.key.should == 'my_api_key'
      end
    end
  end
end

RSpec::Matchers.define :have_debug_enabled do
  match { |actual| actual.debug? }
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
embedly-1.7.1 spec/embedly/configuration_spec.rb
embedly-1.7.0 spec/embedly/configuration_spec.rb
embedly-1.6.0 spec/embedly/configuration_spec.rb
embedly-1.5.6 spec/embedly/configuration_spec.rb
embedly-1.5.5 spec/embedly/configuration_spec.rb
embedly-1.5.4 spec/embedly/configuration_spec.rb
embedly-1.5.3 spec/embedly/configuration_spec.rb
embedly-1.5.2 spec/embedly/configuration_spec.rb
embedly-1.5.1 spec/embedly/configuration_spec.rb
embedly-1.5.0 spec/embedly/configuration_spec.rb
embedly-1.4.1 spec/embedly/configuration_spec.rb
embedly-1.4.0 spec/embedly/configuration_spec.rb
anideo-embedly-1.3.0 spec/embedly/configuration_spec.rb
embedly-1.3.0 spec/embedly/configuration_spec.rb
embedly-1.2.0 spec/embedly/configuration_spec.rb