Sha256: f83ecd51265d8b8d2b6702a0c8089d08dcd69b7e4821da027fd6dd90ee09865a

Contents?: true

Size: 769 Bytes

Versions: 1

Compression:

Stored size: 769 Bytes

Contents

require 'test_helper'

class Forecastr::ClientTest < Minitest::Test
  def test_fetching_city_data_from_api
    stub_get("http://api.openweathermap.org/data/2.5/weather?q=London,UK").to_return(:body => fixture('london.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
    results = Forecastr::Client.search_by_city('London,UK')

    assert_equal results.city, "London"
  end

  def test_fetching_coordinates_data_from_api
    stub_get("http://api.openweathermap.org/data/2.5/weather?lat=42.0&lon=21.4333").to_return(:body => fixture('skopje.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
    results = Forecastr::Client.search_by_coordinates(42.0, 21.4333)

    assert_equal results.city, "Opština Karpoš"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forecastr-0.1.5 test/forecastr/client_test.rb