Sha256: ad83f8597dbee3804756320b64b9cc7d75125cbe518f06e8eafa50bd8999f2b7

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe Darksky::API do
  let(:darksky_api) { Darksky::API.new('this-is-your-dark-sky-api-key') }

  describe '#forecast' do
    it 'should return a valid forecast for a latitude and longitude' do    
      VCR.use_cassette('forecast', :record => :once) do
        forecast = darksky_api.forecast('42.7243','-73.6927')
        forecast['currentSummary'].should == 'clear'
        forecast['radarStation'].should == 'enx'
      end
    end
  end

  describe '#precipitation' do
    it 'should return forecasts for a collection of arbitrary points' do
      VCR.use_cassette('precipitation', :record => :once) do
        precipitation = darksky_api.precipitation(['42.7','-73.6',1325607100,'42.0','-73.0',1325607791])
        precipitation['precipitation'].size.should == 2
        precipitation['precipitation'].first['probability'].should == 0
        precipitation['precipitation'].first['type'].should == 'rain'
      end
    end
  end

  describe '#interesting' do
    it 'should return a list of interesting storms happening right now' do
      VCR.use_cassette('interesting', :record => :once) do
        interesting_storms = darksky_api.interesting
        interesting_storms.size.should == 1
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
darksky-1.0.3 spec/darksky/api_spec.rb