Sha256: b570af048fe00bab38543bed34428b0e9c28ca875f53961551a911aa66bcc1cc

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

require 'spec_helper'

describe Forecastr::Client do
  describe '#search_by_city' do
    it 'gets data from API for city' do
      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')

      expect(results.city).to eq "London"
    end
  end

  describe '#search_by_coordinates' do
    it 'gets data from API by coordinates' do
      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)

      expect(results.city).to eq "Opština Karpoš"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
forecastr-0.1.5 spec/forecastr/client_spec.rb
forecastr-0.1.4 spec/forecastr/client_spec.rb
forecastr-0.1.3 spec/forecastr/client_spec.rb