Sha256: beeb361c4f089260697900dde21052cd721de9bfd9ebe4a7c2b140e0f82662da

Contents?: true

Size: 1.41 KB

Versions: 15

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path('../test_helper', __FILE__)

module Loquor
  class ConfigurationTest < Minitest::Test

    def setup
      Loquor.send(:loquor).instance_variable_set("@config", Configuration.new)
    end

    def test_obtaining_singletion
      refute Loquor.config.nil?
    end

    def test_block_syntax
      test_key = "foobar-123-access"
      Loquor.config do |config|
        config.access_id = test_key
      end
      assert_equal test_key, Loquor.config.access_id
    end

    def test_access_id
      access_id = "test-access-key"
      Loquor.config.access_id = access_id
      assert_equal access_id, Loquor.config.access_id
    end

    def test_secret_key
      secret_key = "test-secret-key"
      Loquor.config.secret_key = secret_key
      assert_equal secret_key, Loquor.config.secret_key
    end

    def test_endpoint
      endpoint = "http://localhost:3000"
      Loquor.config.endpoint = endpoint
      assert_equal endpoint, Loquor.config.endpoint
    end

    def test_missing_access_id_throws_exception
      assert_raises(LoquorConfigurationError) do
        Loquor.config.access_id
      end
    end

    def test_missing_secret_key_throws_exception
      assert_raises(LoquorConfigurationError) do
        Loquor.config.secret_key
      end
    end

    def test_missing_endpoint_throws_exception
      assert_raises(LoquorConfigurationError) do
        Loquor.config.endpoint
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
loquor-0.7.0 test/configuration_test.rb
loquor-0.6.0 test/configuration_test.rb
loquor-0.5.4 test/configuration_test.rb
loquor-0.5.3 test/configuration_test.rb
loquor-0.5.2 test/configuration_test.rb
loquor-0.5.1 test/configuration_test.rb
loquor-0.5.0 test/configuration_test.rb
loquor-0.4.0 test/configuration_test.rb
loquor-0.3.0 test/configuration_test.rb
loquor-0.2.0 test/configuration_test.rb
loquor-0.1.2 test/configuration_test.rb
loquor-0.1.1 test/configuration_test.rb
loquor-0.1.0 test/configuration_test.rb
loquor-0.0.2 test/configuration_test.rb
loquor-0.0.1 test/configuration_test.rb