dronestream 0.1.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/dronestream/strike.rb +31 -9
- data/lib/dronestream/version.rb +1 -1
- data/spec/fixtures/dronestream_cassettes/strike.yml +26520 -0
- data/spec/fixtures/dronestream_cassettes/strikes.yml +8843 -0
- data/spec/lib/dronestream/strike_spec.rb +24 -10
- data/spec/test_helper.rb +1 -0
- metadata +4 -2
@@ -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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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 '#
|
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
|
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
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.
|
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-
|
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
|