forecast_io-cache 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8327fccf795eb13d44b2eaee164cbc16e3341a42
4
- data.tar.gz: b1a7c1f92f19ba6ac78b01c6612310c2736a977b
3
+ metadata.gz: 4a3a830da7beaf6331d52777a3f4063cee109e2a
4
+ data.tar.gz: 6520296466e74b33bc0bb9376cd13cdfd6402bae
5
5
  SHA512:
6
- metadata.gz: 72ea269b95e2654b11740872b4168b8323e0a6415a1eee4e8dfc2c5ab695971790390bfb1599969de86a7c341fddd389494c4b69239e308a4706368b68e145fa
7
- data.tar.gz: 5a84beb2e93d1cea298d7548635f025a77633f50d71adfad84ddf5eeb4ff1cd73044b3c0b39222cfe65a956352afe62ae3f376151b644a6534d0318cd628990a
6
+ metadata.gz: fb851a96237711c48c802ad39ce747453c3e2604a1c12ec07f55403477ade4d640e630911f38de3553c8b5449c23b1a9f731d4685e40482b89aba52be7bf5725
7
+ data.tar.gz: c15589b920e5b570c6021b648fcc38f2add074dfa32d74c88f3b8bc95007b3b89444852c021fe1349e70d5f2c5975624daaa36790ffbc462aea5faeaf3b443be
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "forecast_io"
21
+ spec.add_runtime_dependency "forecast_io", '~> 2.0.1'
22
22
  spec.add_runtime_dependency "sinatra"
23
23
  spec.add_runtime_dependency "mongo_adaptor"
24
24
 
@@ -1,7 +1,7 @@
1
1
  module Forecast
2
2
  module IO
3
3
  module Cache
4
- VERSION = "0.0.4"
4
+ VERSION = "1.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -23,7 +23,7 @@ describe 'service configuration' do
23
23
  end
24
24
 
25
25
  it 'loads mongo config urls' do
26
- Mongo::Configure.should_receive(:from_uri).with 'mongodb://example.com'
26
+ expect(Mongo::Configure).to receive(:from_uri).with 'mongodb://example.com'
27
27
  config.mongo_uri 'mongodb://example.com'
28
28
  end
29
29
 
@@ -1,7 +1,7 @@
1
1
  require 'forecast_io/cache/forecast_data'
2
2
 
3
3
  describe 'representing data from the api' do
4
- subject { Forecast::IO::Cache::ForecastData.generate "1.1", "-1.2", data }
4
+ let(:forecast) { Forecast::IO::Cache::ForecastData.generate "1.1", "-1.2", data }
5
5
 
6
6
  let(:data) do
7
7
  {
@@ -12,22 +12,36 @@ describe 'representing data from the api' do
12
12
  'temperature' => temperature,
13
13
  'pressure' => pressure,
14
14
  'visibility' => visibility,
15
- 'percipIntensity' => percip_intensity
15
+ 'percipIntensity' => precip_intensity
16
16
  }
17
17
  end
18
18
 
19
- %W[time wind_speed wind_bearing humidity temperature pressure visibility percip_intensity].each do |name|
19
+ %W[time wind_speed wind_bearing humidity temperature pressure visibility precip_intensity].each do |name|
20
20
  let(name) { double name }
21
21
  end
22
22
 
23
- its(:time) { should eq time }
24
- its(:position) { should eq [-1.2,1.1] }
25
- its(:wind_speed) { wind_speed }
26
- its(:wind_bearing) { wind_bearing }
27
- its(:humidity) { humidity }
28
- its(:temperature) { temperature }
29
- its(:pressure) { pressure }
30
- its(:visibility) { visibility }
31
- its(:precip_intensity) { percip_intensity }
32
-
23
+ it "exposes time" do
24
+ expect(forecast.time).to eq time
25
+ end
26
+ it "exposes position" do
27
+ expect(forecast.position).to eq [-1.2, 1.1]
28
+ end
29
+ it "exposes wind_speed" do
30
+ expect(forecast.wind_speed).to eq wind_speed
31
+ end
32
+ it "exposes wind_bearing" do
33
+ expect(forecast.wind_bearing).to eq wind_bearing
34
+ end
35
+ it "exposes humidity" do
36
+ expect(forecast.humidity).to eq humidity
37
+ end
38
+ it "exposes temperature" do
39
+ expect(forecast.temperature).to eq temperature
40
+ end
41
+ it "exposes pressure" do
42
+ expect(forecast.pressure).to eq pressure
43
+ end
44
+ it "exposes visibility" do
45
+ expect(forecast.visibility).to eq visibility
46
+ end
33
47
  end
@@ -9,10 +9,10 @@ describe 'producing a forecast' do
9
9
  end
10
10
 
11
11
  context 'when cached data exists' do
12
- before { store.stub(:fetch).and_return data }
12
+ before { allow(store).to receive(:fetch).and_return data }
13
13
 
14
14
  it 'checks the store for a previous cached result' do
15
- store.should_receive(:fetch).with(lat, lon, time)
15
+ expect(store).to receive(:fetch).with(lat, lon, time)
16
16
  forecast.for lat, lon, time
17
17
  end
18
18
 
@@ -23,13 +23,13 @@ describe 'producing a forecast' do
23
23
 
24
24
  context 'when cached data doesnt exist' do
25
25
  before do
26
- generate.stub(:for).and_return data
27
- store.stub(:fetch)
26
+ allow(generate).to receive(:for).and_return data
27
+ allow(store).to receive(:fetch)
28
28
  end
29
29
 
30
30
  it 'checks the store for a previous cached result but then calls the generate' do
31
- store.should_receive(:fetch).with(lat, lon, time)
32
- generate.should_receive(:for).with(lat, lon, time, store)
31
+ expect(store).to receive(:fetch).with(lat, lon, time)
32
+ expect(generate).to receive(:for).with(lat, lon, time, store)
33
33
  forecast.for lat, lon, time
34
34
  end
35
35
 
@@ -11,26 +11,26 @@ describe 'generating new cached results' do
11
11
  end
12
12
 
13
13
  before do
14
- Forecast::IO::Cache::ForecastData.stub(:generate) { |lat,lon,data| send data }
15
- cache.stub(:store) { |data| data }
14
+ allow(Forecast::IO::Cache::ForecastData).to receive(:generate) { |lat,lon,data| send data }
15
+ allow(cache).to receive(:store) { |data| data }
16
16
  end
17
17
 
18
18
  it 'gets the forecast from the api' do
19
- api.should_receive(:forecast).with(lat,lon,time: time)
19
+ expect(api).to receive(:forecast).with(lat,lon,time: time)
20
20
  generate.forecasts
21
21
  end
22
22
 
23
23
  it 'generate forecase data objects' do
24
- Forecast::IO::Cache::ForecastData.should_receive(:generate).with(lat,lon,"data_1")
25
- Forecast::IO::Cache::ForecastData.should_receive(:generate).with(lat,lon,"data_2")
26
- Forecast::IO::Cache::ForecastData.should_receive(:generate).with(lat,lon,"data_3")
24
+ expect(Forecast::IO::Cache::ForecastData).to receive(:generate).with(lat,lon,"data_1")
25
+ expect(Forecast::IO::Cache::ForecastData).to receive(:generate).with(lat,lon,"data_2")
26
+ expect(Forecast::IO::Cache::ForecastData).to receive(:generate).with(lat,lon,"data_3")
27
27
  generate.forecasts
28
28
  end
29
29
 
30
30
  it 'stores the current forecast and all the hourlies' do
31
- cache.should_receive(:store).with(data_1)
32
- cache.should_receive(:store).with(data_2)
33
- cache.should_receive(:store).with(data_3)
31
+ expect(cache).to receive(:store).with(data_1)
32
+ expect(cache).to receive(:store).with(data_2)
33
+ expect(cache).to receive(:store).with(data_3)
34
34
  generate.forecasts
35
35
  end
36
36
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forecast_io-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-23 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: forecast_io
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sinatra
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.2.2
243
+ rubygems_version: 2.5.1
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: Caching layer for forecast_io