Sha256: 681e62784af5b5523480900deb6ae3bb785e03fb7ea32c924d3ba2aecb7d5ad0

Contents?: true

Size: 1.58 KB

Versions: 16

Compression:

Stored size: 1.58 KB

Contents

require_relative '../lib/gmaps_geocoding'
require_relative 'test_helper'

# Main test class
class GmapsGeocodingConfigTest < Test::Unit::TestCase
  def test_config_default
    config = GmapsGeocoding::Config.new
    assert_not_nil config

    assert_equal false, config.valid?
    assert_equal true,  config.json_format?
    assert_equal false, config.xml_format?
  end

  def test_config_default_address
    config = GmapsGeocoding::Config.new
    assert_not_nil config

    assert_equal true, config.url.size > 0
    assert_equal 'json', config.output
    assert_nil config.address
  end

  def test_config_default_optional
    config = GmapsGeocoding::Config.new
    assert_not_nil config
    assert_nil config.latlng
    assert_nil config.components
    assert_equal 'false', config.sensor
    assert_nil config.bounds
    assert_nil config.language
    assert_nil config.region
  end

  def test_config_address_set
    config = GmapsGeocoding::Config.new(address: 'Tour Eiffel, IDF, Paris, France')
    assert_not_nil config
    assert_equal true, config.valid?
  end

  def test_config_latlng_set
    config = GmapsGeocoding::Config.new(latlng: '40.714224,-73.961452')
    assert_not_nil config
    assert_equal true, config.valid?
  end

  def test_config_address_latlng_set
    config = GmapsGeocoding::Config.new(address: 'Tour Eiffel, IDF, Paris, France', latlng: '40.714224,-73.961452')
    assert_not_nil config
    assert_equal false, config.valid?
  end

  def test_config_url
    config = GmapsGeocoding::Config.new(url: 'http://fakeurl.com')
    assert_equal 'http://fakeurl.com', config.url
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gmaps_geocoding-1.3.5 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.3.4 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.3.3 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.3.2 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.3.1 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.3.0 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.2.2 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.2.1 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.2.0 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.1.4 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.1.3 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.1.2 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.1.1 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.1.0 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.0.1 test/gmaps_geocoding_config_test.rb
gmaps_geocoding-1.0.0 test/gmaps_geocoding_config_test.rb