Sha256: 95f161ede500ea3ab5159ebeb334ec69340cb7a51503da1d4e3b746fa2b6c627

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Forecastr::Radar do
  let(:radar) { Forecastr::Radar.new }

  it 'finds forecast 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'})

    forecast = radar.find_by_city("London,UK")

    expect(forecast.city).to eq "London"
    expect(forecast.temperature.to_celsius).to eq 7.64
    expect(forecast.humidity).to eq 70
    expect(forecast.pressure).to eq 1001
  end


  it 'finds forecast 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'})

    forecast = radar.find_by_coordinates(42.000, 21.4333)

    expect(forecast.city).to eq "Opština Karpoš"
    expect(forecast.temperature.to_celsius).to eq 10.7
    expect(forecast.humidity).to eq 70
    expect(forecast.pressure).to eq 1021
  end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forecastr-0.1.5 spec/forecastr/radar_spec.rb
forecastr-0.1.4 spec/forecastr/radar_spec.rb
forecastr-0.1.3 spec/forecastr/radar_spec.rb
forecastr-0.1.2 spec/forecastr/radar_spec.rb
forecastr-0.1.1 spec/forecastr/radar_spec.rb
forecastr-0.1.0 spec/forecastr/radar_spec.rb