fuel_purchase 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,81 @@
1
1
  Feature: Fuel Purchase Committee Calculations
2
2
  The fuel purchase model should generate correct committee calculations
3
3
 
4
- Scenario Outline: Volume Comittee
5
- Given a fuel purchase has "cost" of "<cost>"
6
- And it has "price" of "<price>"
7
- When emissions are calculated
4
+ Scenario Outline: State comittee
5
+ Given a fuel purchase emitter
6
+ And a characteristic "zip_code.name" of "<zip>"
7
+ When the "state" committee is calculated
8
+ Then the conclusion of the committee should have "postal_abbreviation" of "<state>"
9
+ Examples:
10
+ | zip | state |
11
+ | 48915 | MI |
12
+ | 20191 | VA |
13
+
14
+ Scenario Outline: Petroleum Administration for Defense District comittee from state
15
+ Given a fuel purchase emitter
16
+ And a characteristic "zip_code.name" of "<zip>"
17
+ When the "state" committee is calculated
18
+ And the "petroleum_administration_for_defense_district" committee is calculated
19
+ Then the conclusion of the committee should have "district_name" of "<district>"
20
+ And the conclusion of the committee should have "subdistrict_name" of "<subdistrict>"
21
+ Examples:
22
+ | zip | district | subdistrict |
23
+ | 48915 | Midwest | |
24
+ | 20191 | East Coast | Lower Atlantic |
25
+
26
+ Scenario Outline: Price committee from fuel type
27
+ Given a fuel purchase emitter
28
+ And a characteristic "fuel_type.name" of "<fuel_type>"
29
+ When the "price" committee is calculated
30
+ Then the conclusion of the committee should be "<price>"
31
+ Examples:
32
+ | fuel_type | price |
33
+ | Industrial Coking Coal | 0.1302 |
34
+ | Residential Natural Gas | 0.4227 |
35
+ | Kerosene | 0.7059 |
36
+ | Conventional Motor Gasoline | 0.4922 |
37
+
38
+ Scenario Outline: Volume comittee from cost and price
39
+ Given a fuel purchase emitter
40
+ And a characteristic "cost" of "<cost>"
41
+ And a characteristic "price" of "<price>"
42
+ When the "volume" committee is calculated
8
43
  Then the volume committee should be close to <volume>, +/-1
9
44
  Examples:
10
45
  | cost | price | volume |
11
- | 3.0 | 4.0 | 12.0 |
46
+ | 12.0 | 3.0 | 4.0 |
47
+ | 0.0 | 1.0 | 0.0 |
48
+
49
+ Scenario Outline: Volume comittee from fuel type
50
+ Given a fuel purchase emitter
51
+ And a characteristic "fuel_type.name" of "<fuel>"
52
+ When the "volume" committee is calculated
53
+ Then the volume committee should be close to <volume>, +/-1
54
+ Examples:
55
+ | fuel | volume |
56
+ | Residential Natural Gas | 6221.98 |
57
+
58
+ Scenario Outline: Volume comittee from default
59
+ Given a fuel purchase emitter
60
+ When the "volume" committee is calculated
61
+ Then the volume committee should be close to <volume>, +/-1
62
+ Examples:
63
+ | volume |
64
+ | 100 |
65
+
66
+ Scenario Outline: Emission factor committee from fuel type
67
+ Given a fuel purchase emitter
68
+ And a characteristic "fuel_type.name" of "<fuel_type>"
69
+ When the "emission_factor" committee is calculated
70
+ Then the conclusion of the committee should be "<factor>"
71
+ Examples:
72
+ | fuel_type | factor |
73
+ | Industrial Coking Coal | 2.720 |
74
+ | Residential Natural Gas | 1.923 |
75
+ | Kerosene | 2.681 |
76
+ | Conventional Motor Gasoline | 2.358 |
77
+
78
+ Scenario: Emission factor committee from default
79
+ Given a fuel purchase emitter
80
+ When the "emission_factor" committee is calculated
81
+ Then the conclusion of the committee should be "1.0"
@@ -1,12 +1,19 @@
1
1
  Feature: Fuel Purchase Emissions Calculations
2
2
  The fuel purchase model should generate correct emission calculations
3
3
 
4
- Scenario Outline: Standard Calculations for fuel purchase classes
5
- Given a fuel purchase has "zip_code.name" of "<zip_code>"
6
- And it has "fuel_type.name" of "<fuel_type>"
4
+ Scenario Outline: Standard Calculations for fuel purchase classes from fuel type and cost
5
+ Given a fuel purchase has "fuel_type.name" of "<fuel_type>"
6
+ And it has "cost" of "<cost>"
7
7
  When emissions are calculated
8
8
  Then the emission value should be within 0.1 kgs of <emission>
9
9
  Examples:
10
- | zip_code | fuel_type | emission |
11
- | 48915 | Conventional Motor Gasoline | 1234 |
12
- | 22406 | Residential Natural Gas | 11964.8 |
10
+ | fuel_type | cost | emission |
11
+ | Industrial Coking Coal | 100.0 | 2089.1 |
12
+ | Residential Natural Gas | 100.0 | 454.9 |
13
+ | Kerosene | 100.0 | 379.8 |
14
+ | Conventional Motor Gasoline | 100.0 | 479.1 |
15
+
16
+ Scenario: Default fuel purchase emission
17
+ Given a fuel purchase has "emission" of ""
18
+ When emissions are calculated
19
+ Then the emission value should be within 0.1 kgs of 100
@@ -5,4 +5,4 @@ require 'cucumber'
5
5
  require 'cucumber/formatter/unicode'
6
6
 
7
7
  require 'sniff'
8
- Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :earth => [:fuel, :locality]
8
+ Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :earth => [:fuel, :locality], :cucumber => true
@@ -30,7 +30,7 @@ module BrighterPlanet
30
30
  committee :volume do
31
31
  quorum 'from cost and price', :needs => [:cost, :price] do |characteristics|
32
32
  # dollars dollars / variable unit FIXME TODO should we make prices $ / kJ to avoid unit mismatches?
33
- characteristics[:cost] * characteristics[:price]
33
+ characteristics[:cost] / characteristics[:price]
34
34
  end
35
35
 
36
36
  quorum 'from fuel type', :needs => :fuel_type do |characteristics|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuel_purchase
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-08-12 00:00:00 -04:00
22
+ date: 2010-08-17 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -144,12 +144,12 @@ dependencies:
144
144
  requirements:
145
145
  - - "="
146
146
  - !ruby/object:Gem::Version
147
- hash: 3
147
+ hash: 21
148
148
  segments:
149
149
  - 0
150
- - 0
151
- - 14
152
- version: 0.0.14
150
+ - 1
151
+ - 7
152
+ version: 0.1.7
153
153
  requirement: *id008
154
154
  - !ruby/object:Gem::Dependency
155
155
  type: :runtime