dronestream 0.1.1 → 0.2.2

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.
@@ -10,6 +10,7 @@ describe Dronestream::Strike do
10
10
 
11
11
  after do
12
12
  VCR.eject_cassette
13
+ strike.reset
13
14
  end
14
15
 
15
16
  let(:uri) { 'http://api.dronestre.am' }
@@ -18,14 +19,15 @@ describe Dronestream::Strike do
18
19
  expect(Dronestream::Strike.base_uri).to eq(uri)
19
20
  end
20
21
 
21
- describe '#response' do
22
- context 'no error' do
23
- pending 'no error'
24
- end
25
- context 'error' do
26
- pending 'error'
27
- end
28
- end
22
+ # TODO write tests for response erroring
23
+ #describe '#response' do
24
+ #context 'no error' do
25
+ #pending 'no error'
26
+ #end
27
+ #context 'error' do
28
+ #pending 'error'
29
+ #end
30
+ #end
29
31
 
30
32
  describe '#all' do
31
33
  it 'parses the api response from json to array' do
@@ -33,7 +35,7 @@ describe Dronestream::Strike do
33
35
  end
34
36
  end
35
37
 
36
- describe '#country' do
38
+ describe '#in_country' do
37
39
  let(:country_name) { 'Yemen' }
38
40
  it 'takes a country and returns strikes from that country' do
39
41
  expect(strike.in_country(country_name).first['country']).to eq(country_name)
@@ -55,7 +57,7 @@ describe Dronestream::Strike do
55
57
  describe '#in_town' do
56
58
  let(:town_name) { 'Wadi Abida' }
57
59
  it 'returns an array of strikes for a given town' do
58
- expect(strike.in_town(town_name).first['town']).to eq(town_name)
60
+ expect(strike.in_town(town_name).first['town'].include?(town_name)).to be_true
59
61
  end
60
62
  end
61
63
 
@@ -92,5 +94,17 @@ describe Dronestream::Strike do
92
94
  end
93
95
  end
94
96
 
97
+ context 'chaining' do
98
+ let(:new_str) { Dronestream::Strike.in_country('Yemen').with_civilian_casualties.first }
99
+ it 'does not blow up' do
100
+ expect(new_str['country']).to eq('Yemen')
101
+ expect(new_str['civilians']).not_to eq(0)
102
+ end
103
+ let(:new_str2) { Dronestream::Strike.with_civilian_casualties.in_country('Yemen').first }
104
+ it 'does not blow up' do
105
+ expect(new_str2['country']).to eq('Yemen')
106
+ expect(new_str2['civilians']).not_to eq(0)
107
+ end
108
+ end
95
109
  end
96
110
 
data/spec/test_helper.rb CHANGED
@@ -7,6 +7,7 @@ require 'webmock/rspec'
7
7
  #VCR config
8
8
  VCR.configure do |c|
9
9
  c.cassette_library_dir = 'spec/fixtures/dronestream_cassettes'
10
+ c.allow_http_connections_when_no_cassette = false
10
11
  c.hook_into :webmock
11
12
  end
12
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dronestream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thenickcox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-05 00:00:00.000000000 Z
11
+ date: 2013-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,6 +112,7 @@ files:
112
112
  - lib/dronestream/strike.rb
113
113
  - lib/dronestream/version.rb
114
114
  - spec/fixtures/dronestream_cassettes/strike.yml
115
+ - spec/fixtures/dronestream_cassettes/strikes.yml
115
116
  - spec/lib/dronestream/strike_spec.rb
116
117
  - spec/lib/dronestream_test.rb
117
118
  - spec/test_helper.rb
@@ -141,6 +142,7 @@ specification_version: 4
141
142
  summary: A Ruby wrapper for the dronestream API
142
143
  test_files:
143
144
  - spec/fixtures/dronestream_cassettes/strike.yml
145
+ - spec/fixtures/dronestream_cassettes/strikes.yml
144
146
  - spec/lib/dronestream/strike_spec.rb
145
147
  - spec/lib/dronestream_test.rb
146
148
  - spec/test_helper.rb