Sha256: f5c8b84b9dac142d0c99822230e4ae6c35a74242e56c6c07ad1ac8138a626a05

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 Bytes

Contents

require 'test_helper'

class IpgeobaseTest < TestCase
  def setup
    @ip = '46.8.114.116'
    @stub = stub_request(:get, "#{Ipgeobase::URL}?ip=#{@ip}").
      with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
      to_return(:status => 200, :body => load_fixture('response.xml'), :headers => {})
  end

  def test_lookup_http_query
    Ipgeobase.lookup @ip

    assert_requested @stub
  end

  def test_lookup_response_object
    meta = Ipgeobase.lookup @ip

    assert_equal 54.321480, meta.lat
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ipgeobase-0.1.0 test/lib/ipgeobase_test.rb