earth 1.1.0 → 1.1.1
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.
- data/lib/earth/air/airport.rb +1 -0
- data/lib/earth/locality/zip_code.rb +1 -0
- data/lib/earth/version.rb +1 -1
- data/spec/earth/air/aircraft_spec.rb +1 -1
- data/spec/earth/air/airport_spec.rb +11 -0
- data/spec/earth/locality/zip_code_spec.rb +4 -4
- data/spec/earth_spec.rb +1 -1
- data/spec/factories/airline.rb +0 -1
- data/spec/factories/airport.rb +2 -5
- data/spec/factories/flight_segment.rb +0 -28
- data/spec/factories/zip_code.rb +1 -1
- metadata +4 -4
data/lib/earth/air/airport.rb
CHANGED
data/lib/earth/version.rb
CHANGED
@@ -12,7 +12,7 @@ describe Aircraft do
|
|
12
12
|
it { fallback.m3.should be_within(5e-9).of(0.00000013) }
|
13
13
|
it { fallback.m2.should be_within(5e-6).of(-0.00024) }
|
14
14
|
it { fallback.m1.should be_within(5e-2).of(6.2) }
|
15
|
-
it { fallback.b.should be_within(0.5).of(
|
15
|
+
it { fallback.b.should be_within(0.5).of(1378) }
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -1,8 +1,19 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'earth/air/airport'
|
4
|
+
require "#{Earth::FACTORY_DIR}/airport"
|
4
5
|
|
5
6
|
describe Airport do
|
7
|
+
# from geocoder
|
8
|
+
describe '#distance_to' do
|
9
|
+
it "should return distance in km" do
|
10
|
+
a = FactoryGirl.create :airport, :airport1
|
11
|
+
b = FactoryGirl.create :airport, :airport2
|
12
|
+
|
13
|
+
a.distance_to(b).should be_within(5e-6).of(111.19493)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
6
17
|
describe "Sanity check", :sanity => true do
|
7
18
|
it "should have all the data" do
|
8
19
|
Airport.count.should == 5325
|
@@ -2,14 +2,14 @@ require 'spec_helper'
|
|
2
2
|
require "#{Earth::FACTORY_DIR}/zip_code"
|
3
3
|
|
4
4
|
describe ZipCode do
|
5
|
-
# from
|
6
|
-
describe '.
|
7
|
-
it 'returns all zips within radius of the
|
5
|
+
# from geocoder
|
6
|
+
describe '.near(point, radius)' do
|
7
|
+
it 'returns all zips within radius of the point' do
|
8
8
|
zip1 = FactoryGirl.create :zip_code, :zip1
|
9
9
|
zip2 = FactoryGirl.create :zip_code, :zip2
|
10
10
|
zip3 = FactoryGirl.create :zip_code, :zip3
|
11
11
|
|
12
|
-
ZipCode.near(zip1, 15
|
12
|
+
ZipCode.near(zip1, 15).should == [zip1, zip2]
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/spec/earth_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Earth do
|
|
16
16
|
describe '.resources' do
|
17
17
|
it 'should get a list of all resource names' do
|
18
18
|
Earth.init :all
|
19
|
-
Earth.resources.length.should ==
|
19
|
+
Earth.resources.length.should == 103
|
20
20
|
Earth.resources.should include('Aircraft')
|
21
21
|
Earth.resources.should include('Industry')
|
22
22
|
end
|
data/spec/factories/airline.rb
CHANGED
@@ -4,6 +4,5 @@ FactoryGirl.define do
|
|
4
4
|
factory :airline, :class => Airline do
|
5
5
|
trait(:delta) { iata_code 'DL'; name 'Delta'; icao_code 'DAL'; bts_code 'DL' }
|
6
6
|
trait(:united) { iata_code 'UA'; name 'United'; icao_code 'UAL'; bts_code 'UL' }
|
7
|
-
trait(:lufthansa) { iata_code 'LH'; name 'Lufthansa'; icao_code 'DLH'; bts_code 'LH' }
|
8
7
|
end
|
9
8
|
end
|
data/spec/factories/airport.rb
CHANGED
@@ -2,10 +2,7 @@ require 'earth/air/airport'
|
|
2
2
|
|
3
3
|
FactoryGirl.define do
|
4
4
|
factory :airport, :class => Airport do
|
5
|
-
trait(:
|
6
|
-
trait(:
|
7
|
-
trait(:msn) { iata_code 'MSN'; city 'Madison' }
|
8
|
-
trait(:ord) { iata_code 'ORD'; city 'Chicago' }
|
9
|
-
trait(:sfo) { iata_code 'SFO'; city 'San Francisco' }
|
5
|
+
trait(:airport1) { iata_code 'test1'; latitude 0; longitude 0 }
|
6
|
+
trait(:airport2) { iata_code 'test2'; latitude 0; longitude 1 }
|
10
7
|
end
|
11
8
|
end
|
@@ -3,35 +3,7 @@ require 'earth/air/flight_segment'
|
|
3
3
|
FactoryGirl.define do
|
4
4
|
factory :flight_segment, :class => FlightSegment do
|
5
5
|
row_hash { "fake-#{rand(1e11)}" }
|
6
|
-
|
7
|
-
trait(:from_lax) { origin_airport_iata_code 'LAX' }
|
8
|
-
trait(:from_ord) { origin_airport_iata_code 'ORD' }
|
9
|
-
|
10
|
-
trait(:from_los_angeles) { origin_airport_city 'Los Angeles' }
|
11
|
-
trait(:from_chicago) { origin_airport_city 'Chicago' }
|
12
|
-
|
13
|
-
trait(:to_sfo) { destination_airport_iata_code 'SFO' }
|
14
|
-
trait(:to_msn) { destination_airport_iata_code 'MSN' }
|
15
|
-
trait(:to_lax) { destination_airport_iata_code 'LAX' }
|
16
|
-
trait(:to_ord) { destination_airport_iata_code 'ORD' }
|
17
|
-
|
18
|
-
trait(:to_los_angeles) { destination_airport_city 'Los Angeles' }
|
19
|
-
trait(:to_chicago) { destination_airport_city 'Chicago' }
|
20
|
-
|
21
|
-
trait(:june_2010) { month 6; year 2010 }
|
22
|
-
trait(:may_2011) { year 2011; month 5 }
|
23
|
-
trait(:june_2011) { year 2011; month 6 }
|
24
|
-
trait(:may_25_2011) { year 2011; month 5 }
|
25
|
-
trait(:july_2011) { year 2011; month 7 }
|
26
|
-
|
27
|
-
trait(:united) { airline_bts_code 'UA' }
|
28
6
|
trait(:delta) { airline_bts_code 'DL' }
|
29
|
-
trait(:lufthansa) { airline_bts_code 'LH' }
|
30
|
-
trait(:united_icao) { airline_icao_code 'UAL' }
|
31
7
|
trait(:delta_icao) { airline_icao_code 'DAL' }
|
32
|
-
trait(:lufthansa_icao) { airline_icao_code 'DLH' }
|
33
|
-
|
34
|
-
trait(:loaded) { load_factor 0.99 }
|
35
|
-
trait(:empty) { load_factor 0.01 }
|
36
8
|
end
|
37
9
|
end
|
data/spec/factories/zip_code.rb
CHANGED
@@ -4,6 +4,6 @@ FactoryGirl.define do
|
|
4
4
|
factory :zip_code, :class => ZipCode do
|
5
5
|
trait(:zip1) { name 'test1'; latitude '50'; longitude '-75'; egrid_subregion_abbreviation 'CAMX' }
|
6
6
|
trait(:zip2) { name 'test2'; latitude '50'; longitude '-75.1' }
|
7
|
-
trait(:zip3) { name 'test3'; latitude '50'; longitude '-75.
|
7
|
+
trait(:zip3) { name 'test3'; latitude '50'; longitude '-75.3' }
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: earth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Seamus Abshere
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2012-11-
|
15
|
+
date: 2012-11-08 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activerecord
|
@@ -766,7 +766,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
766
766
|
requirements:
|
767
767
|
- - ">="
|
768
768
|
- !ruby/object:Gem::Version
|
769
|
-
hash:
|
769
|
+
hash: 3407051875551125701
|
770
770
|
segments:
|
771
771
|
- 0
|
772
772
|
version: "0"
|
@@ -775,7 +775,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
775
775
|
requirements:
|
776
776
|
- - ">="
|
777
777
|
- !ruby/object:Gem::Version
|
778
|
-
hash:
|
778
|
+
hash: 3407051875551125701
|
779
779
|
segments:
|
780
780
|
- 0
|
781
781
|
version: "0"
|