earth 0.0.43 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/lib/earth/all.rb +0 -1
  2. data/lib/earth/data_miner.rb +0 -1
  3. metadata +5 -45
  4. data/lib/earth/industry.rb +0 -10
  5. data/lib/earth/industry/data_miner.rb +0 -8
  6. data/lib/earth/industry/industries_product_lines.rb +0 -21
  7. data/lib/earth/industry/industries_product_lines/data_miner.rb +0 -13
  8. data/lib/earth/industry/industries_sectors.rb +0 -17
  9. data/lib/earth/industry/industries_sectors/data_miner.rb +0 -12
  10. data/lib/earth/industry/industry.rb +0 -14
  11. data/lib/earth/industry/industry/data_miner.rb +0 -21
  12. data/lib/earth/industry/merchant.rb +0 -18
  13. data/lib/earth/industry/merchant/data_miner.rb +0 -12
  14. data/lib/earth/industry/merchant_categories_industries.rb +0 -20
  15. data/lib/earth/industry/merchant_categories_industries/data_miner.rb +0 -12
  16. data/lib/earth/industry/merchant_category.rb +0 -17
  17. data/lib/earth/industry/merchant_category/data_miner.rb +0 -11
  18. data/lib/earth/industry/product_line.rb +0 -10
  19. data/lib/earth/industry/product_line/data_miner.rb +0 -18
  20. data/lib/earth/industry/product_lines_sectors.rb +0 -18
  21. data/lib/earth/industry/product_lines_sectors/data_miner.rb +0 -14
  22. data/lib/earth/industry/sector.rb +0 -19
  23. data/lib/earth/industry/sector/data_miner.rb +0 -12
  24. data/spec/lib/earth/industry/industries_product_lines_spec.rb +0 -17
  25. data/spec/lib/earth/industry/industries_sectors_spec.rb +0 -17
  26. data/spec/lib/earth/industry/industry_spec.rb +0 -17
  27. data/spec/lib/earth/industry/merchant_categories_industries_spec.rb +0 -16
  28. data/spec/lib/earth/industry/merchant_category_spec.rb +0 -15
  29. data/spec/lib/earth/industry/merchant_spec.rb +0 -17
  30. data/spec/lib/earth/industry/product_line_spec.rb +0 -17
  31. data/spec/lib/earth/industry/product_lines_sectors_spec.rb +0 -17
  32. data/spec/lib/earth/industry/sector_spec.rb +0 -94
  33. data/spec/lib/industries_sectors_spec.rb +0 -17
@@ -4,7 +4,6 @@ require 'earth/bus'
4
4
  require 'earth/diet'
5
5
  require 'earth/fuel'
6
6
  require 'earth/hospitality'
7
- require 'earth/industry'
8
7
  require 'earth/locality'
9
8
  require 'earth/pet'
10
9
  require 'earth/rail'
@@ -4,7 +4,6 @@ require 'earth/bus/data_miner'
4
4
  require 'earth/diet/data_miner'
5
5
  require 'earth/fuel/data_miner'
6
6
  require 'earth/hospitality/data_miner'
7
- require 'earth/industry/data_miner'
8
7
  require 'earth/locality/data_miner'
9
8
  require 'earth/pet/data_miner'
10
9
  require 'earth/rail/data_miner'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earth
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 43
10
- version: 0.0.43
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Seamus Abshere
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-09-17 00:00:00 -05:00
20
+ date: 2010-09-20 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- hash: 299253624
31
+ hash: -1848230024
32
32
  segments:
33
33
  - 3
34
34
  - 0
@@ -323,26 +323,6 @@ files:
323
323
  - lib/earth/hospitality/data_miner.rb
324
324
  - lib/earth/hospitality/lodging_class.rb
325
325
  - lib/earth/hospitality/lodging_class/data_miner.rb
326
- - lib/earth/industry.rb
327
- - lib/earth/industry/data_miner.rb
328
- - lib/earth/industry/industries_product_lines.rb
329
- - lib/earth/industry/industries_product_lines/data_miner.rb
330
- - lib/earth/industry/industries_sectors.rb
331
- - lib/earth/industry/industries_sectors/data_miner.rb
332
- - lib/earth/industry/industry.rb
333
- - lib/earth/industry/industry/data_miner.rb
334
- - lib/earth/industry/merchant.rb
335
- - lib/earth/industry/merchant/data_miner.rb
336
- - lib/earth/industry/merchant_categories_industries.rb
337
- - lib/earth/industry/merchant_categories_industries/data_miner.rb
338
- - lib/earth/industry/merchant_category.rb
339
- - lib/earth/industry/merchant_category/data_miner.rb
340
- - lib/earth/industry/product_line.rb
341
- - lib/earth/industry/product_line/data_miner.rb
342
- - lib/earth/industry/product_lines_sectors.rb
343
- - lib/earth/industry/product_lines_sectors/data_miner.rb
344
- - lib/earth/industry/sector.rb
345
- - lib/earth/industry/sector/data_miner.rb
346
326
  - lib/earth/inflectors.rb
347
327
  - lib/earth/locality.rb
348
328
  - lib/earth/locality/census_division.rb
@@ -440,17 +420,7 @@ files:
440
420
  - vendor/geokit-rails/test/schema.rb
441
421
  - vendor/geokit-rails/test/tasks.rake
442
422
  - vendor/geokit-rails/test/test_helper.rb
443
- - spec/lib/earth/industry/industries_product_lines_spec.rb
444
- - spec/lib/earth/industry/industries_sectors_spec.rb
445
- - spec/lib/earth/industry/industry_spec.rb
446
- - spec/lib/earth/industry/merchant_categories_industries_spec.rb
447
- - spec/lib/earth/industry/merchant_category_spec.rb
448
- - spec/lib/earth/industry/merchant_spec.rb
449
- - spec/lib/earth/industry/product_line_spec.rb
450
- - spec/lib/earth/industry/product_lines_sectors_spec.rb
451
- - spec/lib/earth/industry/sector_spec.rb
452
423
  - spec/lib/earth_spec.rb
453
- - spec/lib/industries_sectors_spec.rb
454
424
  - spec/spec_helper.rb
455
425
  - Gemfile
456
426
  - Gemfile.lock
@@ -489,17 +459,7 @@ signing_key:
489
459
  specification_version: 3
490
460
  summary: Land, sky, and sea
491
461
  test_files:
492
- - spec/lib/earth/industry/industries_product_lines_spec.rb
493
- - spec/lib/earth/industry/industries_sectors_spec.rb
494
- - spec/lib/earth/industry/industry_spec.rb
495
- - spec/lib/earth/industry/merchant_categories_industries_spec.rb
496
- - spec/lib/earth/industry/merchant_category_spec.rb
497
- - spec/lib/earth/industry/merchant_spec.rb
498
- - spec/lib/earth/industry/product_line_spec.rb
499
- - spec/lib/earth/industry/product_lines_sectors_spec.rb
500
- - spec/lib/earth/industry/sector_spec.rb
501
462
  - spec/lib/earth_spec.rb
502
- - spec/lib/industries_sectors_spec.rb
503
463
  - spec/spec_helper.rb
504
464
  - Gemfile
505
465
  - Gemfile.lock
@@ -1,10 +0,0 @@
1
- require 'earth/industry/industries_product_lines'
2
- require 'earth/industry/industries_sectors'
3
- require 'earth/industry/industry'
4
- require 'earth/industry/merchant'
5
- require 'earth/industry/merchant_categories_industries'
6
- require 'earth/industry/merchant_category'
7
- require 'earth/industry/product_line'
8
- require 'earth/industry/product_lines_sectors'
9
- require 'earth/industry/sector'
10
-
@@ -1,8 +0,0 @@
1
- require 'earth/industry/industries_product_lines/data_miner'
2
- require 'earth/industry/industries_sectors/data_miner'
3
- require 'earth/industry/industry/data_miner'
4
- require 'earth/industry/merchant/data_miner'
5
- require 'earth/industry/merchant_categories_industries/data_miner'
6
- require 'earth/industry/product_line/data_miner'
7
- require 'earth/industry/product_lines_sectors/data_miner'
8
- require 'earth/industry/sector/data_miner'
@@ -1,21 +0,0 @@
1
- class IndustriesProductLines < ActiveRecord::Base
2
- extend Earth::Base
3
- set_primary_key :row_hash
4
-
5
- belongs_to :industry, :foreign_key => 'naics_code'
6
- belongs_to :product_line, :foreign_key => 'ps_code'
7
-
8
- def self.schema_definition
9
- lambda do
10
- string 'row_hash'
11
- string 'naics_code'
12
- float 'ratio'
13
- string 'ps_code'
14
- float 'revenue_allocated'
15
- end
16
- end
17
-
18
- data_miner do
19
- IndustriesProductLines.define_schema(self)
20
- end
21
- end
@@ -1,13 +0,0 @@
1
- IndustriesProductLines.class_eval do
2
- data_miner do
3
- IndustriesProductLines.define_schema(self)
4
-
5
- import "sectors dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdHV2dzdjdGVnLUJCdDA4TURXNThROVE&hl=en&single=true&gid=1&output=csv' do
7
- key 'ps_code'
8
- store 'naics_code'
9
- store 'ratio'
10
- store 'revenue_allocated'
11
- end
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- class IndustriesSectors < ActiveRecord::Base
2
- extend Earth::Base
3
- belongs_to :industry, :foreign_key => 'naics_code'
4
- belongs_to :sector, :foreign_key => 'io_code'
5
-
6
- def self.schema_definition
7
- lambda do
8
- string 'naics_code'
9
- float 'ratio'
10
- string 'io_code'
11
- end
12
- end
13
-
14
- data_miner do
15
- IndustriesSectors.define_schema(self)
16
- end
17
- end
@@ -1,12 +0,0 @@
1
- IndustriesSectors.class_eval do
2
- data_miner do
3
- IndustriesSectors.define_schema(self)
4
-
5
- import "industries to sectors dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdDVjVWRJdmVrcEtNd0U5Z3NxdGRlN1E&hl=en&single=true&gid=0&output=csv' do
7
- key 'naics_code'
8
- store 'ratio'
9
- store 'io_code'
10
- end
11
- end
12
- end
@@ -1,14 +0,0 @@
1
- class Industry < ActiveRecord::Base
2
- set_primary_key :naics_code
3
-
4
- has_many :industries_product_lines, :foreign_key => 'naics_code'
5
- has_many :product_lines, :through => :industries_product_lines
6
- has_many :industries_sectors, :foreign_key => 'naics_code'
7
- has_many :sectors, :through => :industries_sectors
8
- has_many :merchant_categories_industries, :foreign_key => 'naics_code',
9
- :class_name => 'MerchantCategoriesIndustries'
10
-
11
- data_miner do
12
- tap "Brighter Planet's industry data", Earth.taps_server
13
- end
14
- end
@@ -1,21 +0,0 @@
1
- Industry.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'naics_code'
5
- string 'description'
6
- end
7
-
8
- # FIXME TODO some codes need to be disaggregated:
9
- # 31-33 "manufacturing" should be 31, 32, 33 all "manufacturing"
10
- # 44-45 "retail trade" should be 44 and 45 "retail trade"
11
- # 48-49 "transportation and warehouseing" should be 48 and 49 "transportation and warehousing"
12
- import "the U.S. Census 2002 NAICS code list",
13
- :url => 'http://www.census.gov/epcd/naics02/naicod02.txt',
14
- :skip => 4,
15
- :headers => false,
16
- :delimiter => ' ' do
17
- key 'naics_code', :field_number => 0
18
- store 'description', :field_number => 1
19
- end
20
- end
21
- end
@@ -1,18 +0,0 @@
1
- class Merchant < ActiveRecord::Base
2
- extend Earth::Base
3
- set_primary_key :id
4
-
5
- belongs_to :merchant_category, :foreign_key => 'mcc'
6
-
7
- def self.schema_definition
8
- lambda do
9
- string 'id'
10
- string 'name'
11
- string 'mcc'
12
- end
13
- end
14
-
15
- data_miner do
16
- Merchant.define_schema(self)
17
- end
18
- end
@@ -1,12 +0,0 @@
1
- Merchant.class_eval do
2
- data_miner do
3
- Merchant.define_schema(self)
4
-
5
- import "merchant dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdElxWTd0ckpfVXJ6OVFxLUhwR0ZOVXc&hl=en&single=true&gid=0&output=csv' do
7
- key 'id'
8
- store 'name'
9
- store 'mcc'
10
- end
11
- end
12
- end
@@ -1,20 +0,0 @@
1
- class MerchantCategoriesIndustries < ActiveRecord::Base
2
- extend Earth::Base
3
-
4
- belongs_to :merchant_category, :foreign_key => 'mcc'
5
- belongs_to :industry, :foreign_key => 'naics_code'
6
- has_many :industries_product_lines, :through => :industry, :class_name => 'IndustriesProductLines'
7
- has_many :industries_sectors, :through => :industry, :class_name => 'IndustriesSectors'
8
-
9
- def self.schema_definition
10
- lambda do
11
- string 'mcc'
12
- float 'ratio'
13
- string 'naics_code'
14
- end
15
- end
16
-
17
- data_miner do
18
- MerchantCategoriesIndustries.define_schema(self)
19
- end
20
- end
@@ -1,12 +0,0 @@
1
- MerchantCategoriesIndustries.class_eval do
2
- data_miner do
3
- MerchantCategoriesIndustries.define_schema(self)
4
-
5
- import "merchant categories to industries dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdHpDbjNwTHBmY252V01CQ1lOUUVMU1E&hl=en&single=true&gid=0&output=csv' do
7
- key 'naics_code'
8
- store 'mcc'
9
- store 'ratio'
10
- end
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- class MerchantCategory < ActiveRecord::Base
2
- set_primary_key :mcc
3
-
4
- has_many :merchant_categories_industries, :foreign_key => 'mcc', :class_name => 'MerchantCategoriesIndustries'
5
- has_many :industries, :through => :merchant_categories_industries
6
-
7
- def name
8
- description
9
- end
10
-
11
- data_miner do
12
- schema Earth.database_options do
13
- string 'mcc'
14
- string 'description'
15
- end
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- MerchantCategory.class_eval do
2
- data_miner do
3
- MerchantCategory.define_schema(self)
4
-
5
- import "merchant category dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdEx2WGZpbTRLdzJub05VR3pyQThRMGc&hl=en&single=true&gid=0&output=csv' do
7
- key 'mcc'
8
- store 'description'
9
- end
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- class ProductLine < ActiveRecord::Base
2
- set_primary_key :ps_code
3
-
4
- has_many :product_lines_sectors, :foreign_key => 'ps_code'
5
- has_many :sectors, :through => :product_lines_sectors
6
-
7
- data_miner do
8
- tap "Brighter Planet's product line data", Earth.taps_server
9
- end
10
- end
@@ -1,18 +0,0 @@
1
- ProductLine.class_eval do
2
- data_miner do
3
- schema Earth.database_options do
4
- string 'ps_code'
5
- string 'description'
6
- string 'broadline' # FIXME TODO do we need this?
7
- string 'parent' # FIXME TODO do we need this?
8
- end
9
-
10
- import "the U.S. Census list of Products and Services codes for the wholesale and retail trade sectors",
11
- :url => 'http://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdGxOUzBId0VuWTB0U0dOUHExOVlWTlE&hl=en&single=true&gid=0&output=csv' do
12
- key 'ps_code'
13
- store 'description'
14
- store 'broadline'
15
- store 'parent'
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- class ProductLinesSectors < ActiveRecord::Base
2
- extend Earth::Base
3
- belongs_to :product_line, :foreign_key => 'ps_code'
4
- belongs_to :sector, :foreign_key => 'io_code'
5
-
6
- def self.schema_definition
7
- lambda do
8
- string 'row_hash'
9
- string 'ps_code'
10
- float 'ratio'
11
- string 'io_code'
12
- end
13
- end
14
-
15
- data_miner do
16
- ProductLinesSectors.define_schema(self)
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- ProductLinesSectors.class_eval do
2
- data_miner do
3
- ProductLinesSectors.define_schema(self)
4
-
5
- import "product lines to sectors dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdHRwWXRWai0tQnpxb2RfNFN3ZXROY1E&hl=en&single=true&gid=0&output=csv' do
7
- key 'ps_code'
8
- store 'ps_code_meaning'
9
- store 'ratio'
10
- store 'io_code'
11
- store 'io_meaning'
12
- end
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- class Sector < ActiveRecord::Base
2
- extend Earth::Base
3
- set_primary_key :io_code
4
-
5
- has_many :product_lines_sectors, :class_name => 'ProductLinesSectors', :foreign_key => 'io_code'
6
-
7
- def self.schema_definition
8
- lambda do
9
- string 'io_code'
10
- string 'description'
11
- float 'emission_factor'
12
- string 'emission_factor_units'
13
- end
14
- end
15
-
16
- data_miner do
17
- Sector.define_schema(self)
18
- end
19
- end
@@ -1,12 +0,0 @@
1
- Sector.class_eval do
2
- data_miner do
3
- Sector.define_schema(self)
4
-
5
- import "sectors dictionary",
6
- :url => 'https://spreadsheets.google.com/pub?key=0AoQJbWqPrREqdHV2dzdjdGVnLUJCdDA4TURXNThROVE&hl=en&single=true&gid=1&output=csv' do
7
- key 'io_code'
8
- store 'description'
9
- store 'emission_factor', :units_field_name => 'emission_factor_units'
10
- end
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe IndustriesProductLines do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/industries_product_lines/data_miner'
9
- end
10
- it 'should import data' do
11
- IndustriesProductLines.destroy_all
12
- DataMiner.run :resource_names => 'IndustriesProductLines'
13
- IndustriesProductLines.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe IndustriesSectors do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/industries_sectors/data_miner'
9
- end
10
- it 'should import data' do
11
- IndustriesSectors.destroy_all
12
- DataMiner.run :resource_names => 'IndustriesSectors'
13
- IndustriesSectors.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe Industry do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/industry/data_miner'
9
- end
10
- it 'should import data' do
11
- Industry.destroy_all
12
- DataMiner.run :resource_names => 'Industry'
13
- Industry.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe MerchantCategoriesIndustries do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/merchant/data_miner'
9
- end
10
- it 'should import data' do
11
- MerchantCategoriesIndustries.destroy_all
12
- DataMiner.run :resource_names => 'MerchantCategoriesIndustries'
13
- MerchantCategoriesIndustries.count.should > 1
14
- end
15
- end
16
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe MerchantCategory do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- end
9
- it 'should import data' do
10
- MerchantCategory.destroy_all
11
- DataMiner.run :resource_names => 'MerchantCategory'
12
- MerchantCategory.count.should > 1
13
- end
14
- end
15
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe Merchant do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/merchant/data_miner'
9
- end
10
- it 'should import data' do
11
- Merchant.destroy_all
12
- DataMiner.run :resource_names => 'Merchant'
13
- Merchant.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe ProductLine do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/merchant/data_miner'
9
- end
10
- it 'should import data' do
11
- ProductLine.destroy_all
12
- DataMiner.run :resource_names => 'ProductLine'
13
- ProductLine.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe ProductLinesSectors do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/merchant/data_miner'
9
- end
10
- it 'should import data' do
11
- ProductLinesSectors.destroy_all
12
- DataMiner.run :resource_names => 'ProductLinesSectors'
13
- ProductLinesSectors.count.should > 1
14
- end
15
- end
16
- end
17
-
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe Sector do
5
- def stub_sector
6
- Sector.stub!(:all).
7
- and_return([
8
- mock(Sector, :io_code => '1', :description => 'Staples'),
9
- mock(Sector, :io_code => '2', :description => 'Example'),
10
- mock(Sector, :io_code => '3', :description => 'Pencils'),
11
- mock(Sector, :io_code => '4', :description => 'Pens'),
12
- mock(Sector, :io_code => '5', :description => 'Rulers'),
13
- mock(Sector, :io_code => '6', :description => 'Printers'),
14
- mock(Sector, :io_code => '7', :description => 'Computers'),
15
- mock(Sector, :io_code => '8', :description => 'Ink'),
16
- mock(Sector, :io_code => '9', :description => 'Paper'),
17
- mock(Sector, :io_code => '10', :description => 'Furniture'),
18
- mock(Sector, :io_code => '11', :description => 'Trucking'),
19
- mock(Sector, :io_code => '12', :description => 'Sales'),
20
- mock(Sector, :io_code => '13', :description => 'Strip Malls'),
21
- mock(Sector, :io_code => '14', :description => 'Displays'),
22
- mock(Sector, :io_code => '15', :description => 'Cameras'),
23
- mock(Sector, :io_code => '16', :description => 'Scanners'),
24
- mock(Sector, :io_code => '17', :description => 'Disks'),
25
- mock(Sector, :io_code => '18', :description => 'Media'),
26
- mock(Sector, :io_code => '19', :description => 'Hotel Industry'),
27
- mock(Sector, :io_code => '20', :description => 'Example'),
28
- mock(Sector, :io_code => 'A', :description => 'Young fantasy creature processing'),
29
- mock(Sector, :io_code => 'B', :description => 'Adult fantasy creature processing'),
30
- mock(Sector, :io_code => 'C', :description => 'Young fantasy creature freezing'),
31
- mock(Sector, :io_code => 'D', :description => 'Adult fantasy creature freezing')
32
- ])
33
- end
34
-
35
- describe 'key_map' do
36
- before do
37
- stub_sector
38
- end
39
-
40
- it 'should return a sorted list of keys' do
41
- Sector.key_map[0..1].should == ['1','10']
42
- Sector.key_map[21..22].should == ['C','D']
43
- end
44
- end
45
-
46
- describe 'sector_map' do
47
- before do
48
- stub_sector
49
- end
50
-
51
- it 'should generate a hash mapping sector names to io codes' do
52
- Sector.sector_map.should == {
53
- 'Staples' => '1',
54
- 'Example' => '2',
55
- 'Pencils' => '3',
56
- 'Pens' => '4',
57
- 'Rulers' => '5',
58
- 'Printers' => '6',
59
- 'Computers' => '7',
60
- 'Ink' => '8',
61
- 'Paper' => '9',
62
- 'Furniture' => '10',
63
- 'Trucking' => '11',
64
- 'Sales' => '12',
65
- 'Strip Malls' => '13',
66
- 'Displays' => '14',
67
- 'Cameras' => '15',
68
- 'Scanners' => '16',
69
- 'Disks' => '17',
70
- 'Media' => '18',
71
- 'Hotel Industry' => '19',
72
- 'Example' => '20',
73
- 'Young fantasy creature processing' => 'A',
74
- 'Adult fantasy creature processing' => 'B',
75
- 'Young fantasy creature freezing' => 'C',
76
- 'Adult fantasy creature freezing' => 'D'
77
- }
78
- end
79
- end
80
-
81
- describe 'data_miner import' do
82
- before :all do
83
- require 'data_miner'
84
- require 'earth/industry/sector/data_miner'
85
- end
86
- it 'should import data' do
87
- Sector.destroy_all
88
- DataMiner.run :resource_names => 'Sector'
89
- Sector.count.should > 1
90
- Sector.first.emission_factor_units.should == 'kilograms_per_2002_dollar'
91
- end
92
- end
93
- end
94
-
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
- Earth.init :industry, :apply_schemas => true
3
-
4
- describe IndustriesProductLines do
5
- describe 'data_miner import' do
6
- before :all do
7
- require 'data_miner'
8
- require 'earth/industry/industries_product_lines/data_miner'
9
- end
10
- it 'should import data' do
11
- IndustriesProductLines.destroy_all
12
- DataMiner.run :resource_names => 'IndustriesProductLines'
13
- IndustriesProductLines.count.should > 1
14
- end
15
- end
16
- end
17
-