Sha256: 552c04b5797a75753f42112860057e75c26357715b85b4a3d982235d42f75a24

Contents?: true

Size: 1.7 KB

Versions: 10

Compression:

Stored size: 1.7 KB

Contents

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

module Inquisitio
  class ConfigurationTest < Minitest::Test

    def setup
      Inquisitio.instance_variable_set("@config", nil)
    end

    def test_obtaining_singletion
      refute Inquisitio.config.nil?
    end

    def test_block_syntax
      test_search_endpoint = "foobar-123-endpoint"
      Inquisitio.config do |config|
        config.search_endpoint = test_search_endpoint
      end
      assert_equal test_search_endpoint, Inquisitio.config.search_endpoint
    end

    def test_search_endpoint
      search_endpoint = "test-search-endpoint"
      Inquisitio.config.search_endpoint = search_endpoint
      assert_equal search_endpoint, Inquisitio.config.search_endpoint
    end

    def test_missing_search_endpoint_throws_exception
      assert_raises(InquisitioConfigurationError) do
        Inquisitio.config.search_endpoint
      end
    end

    def test_document_endpoint
      document_endpoint = "test-document-endpoint"
      Inquisitio.config.document_endpoint = document_endpoint
      assert_equal document_endpoint, Inquisitio.config.document_endpoint
    end

    def test_missing_document_endpoint_throws_exception
      assert_raises(InquisitioConfigurationError) do
        Inquisitio.config.document_endpoint
      end
    end

    def test_default_search_size
      default_search_size = "test-default_search_size"
      Inquisitio.config.default_search_size = default_search_size
      assert_equal default_search_size, Inquisitio.config.default_search_size
    end

    def test_missing_default_search_size_throws_exception
      assert_raises(InquisitioConfigurationError) do
        Inquisitio.config.default_search_size
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
inquisitio-0.1.6 test/configuration_test.rb
inquisitio-0.1.5 test/configuration_test.rb
inquisitio-0.1.4 test/configuration_test.rb
inquisitio-0.1.3 test/configuration_test.rb
inquisitio-0.1.2 test/configuration_test.rb
inquisitio-0.1.1 test/configuration_test.rb
inquisitio-0.1.0 test/configuration_test.rb
inquisitio-0.0.13 test/configuration_test.rb
inquisitio-0.0.12 test/configuration_test.rb
inquisitio-0.0.11 test/configuration_test.rb