Sha256: a978aeed40f99c6b57c08c8a445548da818cb9d3a4656ecc51a74827961a76a1

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

require 'helper'

describe 'configuration' do

    before do
      CheckMobi.reset
    end

    describe '.api_key' do
      it 'should return default key' do
          CheckMobi.api_key.must_equal CheckMobi::Configuration::DEFAULT_API_KEY
      end
    end

    describe '.format' do
      it 'should return default fomat' do
          CheckMobi.format.must_equal CheckMobi::Configuration::DEFAULT_FORMAT
      end
    end

    describe '.method' do
      it 'should return default method' do
          CheckMobi.method.must_equal CheckMobi::Configuration::DEFAULT_METHOD
      end
    end

    describe '.user_agent' do
      it 'should return default user agent' do
        CheckMobi.user_agent.must_equal CheckMobi::Configuration::DEFAULT_USER_AGENT
      end
    end

    CheckMobi::Configuration::VALID_CONFIG_KEYS.each do |key|
      describe ".#{key}" do
        it 'should return the default value' do
          CheckMobi.send(key).must_equal CheckMobi::Configuration.const_get("DEFAULT_#{key.upcase}")
        end
      end
    end

    describe '.configure' do
      CheckMobi::Configuration::VALID_CONFIG_KEYS.each do |key|
        it "should set the #{key}" do
          CheckMobi.configure do |config|
            config.send("#{key}=", key)
            CheckMobi.send(key).must_equal key
          end # CheckMobi.configure
        end # describe 'it should set the key'
      end # CheckMobi::Configuration::VALID_CONFIG_KEYS
    end # describe '.configure'

    after do
      CheckMobi.reset
    end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
check_mobi-1.0.5 test/check_mobi/configuration_test.rb
check_mobi-1.0.4 test/check_mobi/configuration_test.rb
check_mobi-1.0.3 test/check_mobi/configuration_test.rb
check_mobi-1.0.2 test/check_mobi/configuration_test.rb
check_mobi-1.0.1 test/check_mobi/configuration_test.rb