automobile 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,36 @@
1
1
  Feature: Automobile Committee Calculations
2
2
  The automobile model should generate correct committee calculations
3
3
 
4
- Scenario Outline: Acquisition committee
5
- Given an automobile has "acquisition" of "<acquisition>"
6
- And it has "model_year.name" "<make_model_year>"
7
- When emissions are calculated
8
- Then the acquisition committee should be exactly <acquisition_committee>
4
+ Scenario Outline: Retirement committee from acquisition
5
+ Given an automobile emitter
6
+ And a characteristic "timeframe" of "<timeframe>"
7
+ And a characteristic "acquisition" of "<acquisition>"
8
+ When the "retirement" committee is calculated
9
+ Then the conclusion of the committee should be "<retirement_committee>"
9
10
  Examples:
10
- | make_model_year | acquisition | acquisition_committee |
11
- | | 2007-01-30 | 2007-01-30 |
12
- | Honda FIT 2008 | | 2010-01-01 |
11
+ | timeframe | acquisition | retirement_committee |
12
+ | 2009-03-04/2009-08-17 | 2010-04-21 | 2010-04-21 |
13
+ | 2009-03-04/2009-08-17 | 2007-01-30 | 2009-08-17 |
14
+ | 2009-03-04/2009-08-17 | | 2009-08-17 |
13
15
 
14
- Scenario Outline: Retirement committees
15
- Given an automobile has "acquisition" of "<acquisition>"
16
- And it has "model_year.name" "<make_model_year>"
17
- When emissions are calculated
18
- Then the retirement committee should be exactly <retirement_committee>
16
+ Scenario Outline: Acquisition committee from model year or year
17
+ Given an automobile emitter
18
+ And a characteristic "model_year.name" of "<make_model_year>"
19
+ And a characteristic "year" of "<year>"
20
+ When the "acquisition" committee is calculated
21
+ Then the conclusion of the committee should be "<acquisition_committee>"
19
22
  Examples:
20
- | acquisition | retirement | retirement_committee |
21
- | 2007-01-30 | 2009-03-04 | 2011-01-01 |
23
+ | make_model_year | year | acquisition_committee |
24
+ | | 2007 | 2007-01-01 |
25
+ | Honda FIT 2008 | | 2008-01-01 |
26
+
27
+ Scenario Outline: Acquisition committee from retirement
28
+ Given an automobile emitter
29
+ And a characteristic "timeframe" of "<timeframe>"
30
+ And a characteristic "retirement" of "<retirement>"
31
+ When the "acquisition" committee is calculated
32
+ Then the conclusion of the committee should be "<acquisition_committee>"
33
+ Examples:
34
+ | timeframe | retirement | acquisition_committee |
35
+ | 2010-08-10/2010-09-16 | 2007-02-03 | 2007-02-03 |
36
+ | 2010-08-10/2010-09-16 | | 2010-08-10 |
@@ -2,13 +2,12 @@ Feature: Automobile Emissions Calculations
2
2
  The automobile model should generate correct emission calculations
3
3
 
4
4
  Scenario Outline: Standard Calculations for automobiles
5
- Given an automobile has "annual_distance_estimate" of "<annual_distance>"
6
- And it has "model_year.name" "<make_model_year>"
7
- And it has "acquisition" "<acquisition>"
8
- And it has "retirement" "<retirement>"
5
+ Given an automobile has "annual_distance_estimate" of "<distance>"
6
+ And it has "timeframe" of "<timeframe>"
7
+ And it has "model_year.name" of "<make_model_year>"
9
8
  When emissions are calculated
10
- Then the emission value should be within 0.1 kgs of <emission>
9
+ Then the emission value should be within "0.1" kgs of "<emission>"
11
10
  Examples:
12
- | annual_distance | make_model_year | acquisition | retirement | emission |
13
- | 30000 | Acura RSX 2003 | 2008-01-30 | 2009-05-15 | 123 |
14
- | 30000 | Honda FIT 2008 | 2008-01-30 | 2009-05-15 | 123 |
11
+ | distance | make_model_year | timeframe | emission |
12
+ | 30000 | Acura RSX 2003 | 2008-01-30/2009-05-20| 8706.4 |
13
+ | 80000 | Honda FIT 2008 | 2008-01-30/2009-05-20| 23217.1 |
@@ -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 => :automobile
8
+ Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :earth => :automobile, :cucumber => true
@@ -1,11 +1,9 @@
1
- require 'leap'
2
1
  require 'conversions'
3
2
 
4
3
  module BrighterPlanet
5
4
  module Automobile
6
5
  module CarbonModel
7
6
  def self.included(base)
8
- base.extend ::Leap::Subject
9
7
  base.decide :emission, :with => :characteristics do
10
8
  committee :emission do # returns kg CO2
11
9
  quorum 'from fuel', :needs => [:fuel_consumed, :emission_factor], :appreciates => :fuel_type do |characteristics|
@@ -187,8 +185,11 @@ module BrighterPlanet
187
185
 
188
186
  committee :acquisition do
189
187
  quorum 'from model year or year', :appreciates => [:model_year, :year] do |characteristics|
190
- puts characteristics.inspect
191
- !characteristics.empty? && Date.new((characteristics[:model_year].andand.year || characteristics[:year]).to_i - 1, 1, 1)
188
+ if characteristics[:model_year]
189
+ Date.new characteristics[:model_year].year, 1, 1
190
+ elsif characteristics[:year]
191
+ Date.new characteristics[:year].to_i, 1, 1
192
+ end
192
193
  end
193
194
  quorum 'from retirement', :appreciates => :retirement do |characteristics, timeframe|
194
195
  [ timeframe.from, characteristics[:retirement] ].compact.min
@@ -1,10 +1,7 @@
1
- require 'characterizable'
2
-
3
1
  module BrighterPlanet
4
2
  module Automobile
5
3
  module Characterization
6
4
  def self.included(base)
7
- base.send :include, Characterizable
8
5
  base.characterize do
9
6
  has :make do |make|
10
7
  make.reveals :model_year do |model_year|
@@ -35,7 +32,6 @@ module BrighterPlanet
35
32
  # has :annual_fuel_cost, :trumps => [:annual_distance_estimate, :weekly_distance_estimate, :daily_distance_estimate, :daily_duration, :weekly_fuel_cost], :measures => :cost
36
33
  # has :weekly_fuel_cost, :trumps => [:annual_distance_estimate, :weekly_distance_estimate, :daily_distance_estimate, :daily_duration, :annual_fuel_cost], :measures => :cost
37
34
  end
38
- base.add_implicit_characteristics
39
35
  end
40
36
  end
41
37
  end
@@ -1,5 +1,3 @@
1
- require 'data_miner'
2
-
3
1
  module BrighterPlanet
4
2
  module Automobile
5
3
  module Data
@@ -1,10 +1,7 @@
1
- require 'summary_judgement'
2
-
3
1
  module BrighterPlanet
4
2
  module Automobile
5
3
  module Summarization
6
4
  def self.included(base)
7
- base.extend SummaryJudgement
8
5
  base.summarize do |has|
9
6
  has.adjective :model_year
10
7
  has.adjective :make
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automobile
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
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-09-13 00:00:00 -04:00
22
+ date: 2010-09-21 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -29,15 +29,14 @@ dependencies:
29
29
  version_requirements: &id001 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - "="
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- hash: -1848230024
34
+ hash: 7
35
35
  segments:
36
36
  - 3
37
37
  - 0
38
38
  - 0
39
- - beta4
40
- version: 3.0.0.beta4
39
+ version: 3.0.0
41
40
  requirement: *id001
42
41
  - !ruby/object:Gem::Dependency
43
42
  type: :development
@@ -46,16 +45,14 @@ dependencies:
46
45
  version_requirements: &id002 !ruby/object:Gem::Requirement
47
46
  none: false
48
47
  requirements:
49
- - - ">="
48
+ - - ~>
50
49
  - !ruby/object:Gem::Version
51
- hash: 62196359
50
+ hash: 23
52
51
  segments:
53
52
  - 1
54
53
  - 0
55
54
  - 0
56
- - beta
57
- - 2
58
- version: 1.0.0.beta.2
55
+ version: 1.0.0
59
56
  requirement: *id002
60
57
  - !ruby/object:Gem::Dependency
61
58
  type: :development
@@ -64,7 +61,7 @@ dependencies:
64
61
  version_requirements: &id003 !ruby/object:Gem::Requirement
65
62
  none: false
66
63
  requirements:
67
- - - "="
64
+ - - ~>
68
65
  - !ruby/object:Gem::Version
69
66
  hash: 57
70
67
  segments:
@@ -80,7 +77,7 @@ dependencies:
80
77
  version_requirements: &id004 !ruby/object:Gem::Requirement
81
78
  none: false
82
79
  requirements:
83
- - - "="
80
+ - - ~>
84
81
  - !ruby/object:Gem::Version
85
82
  hash: 7
86
83
  segments:
@@ -124,7 +121,7 @@ dependencies:
124
121
  version_requirements: &id007 !ruby/object:Gem::Requirement
125
122
  none: false
126
123
  requirements:
127
- - - "="
124
+ - - ~>
128
125
  - !ruby/object:Gem::Version
129
126
  hash: 62196417
130
127
  segments:
@@ -142,14 +139,14 @@ dependencies:
142
139
  version_requirements: &id008 !ruby/object:Gem::Requirement
143
140
  none: false
144
141
  requirements:
145
- - - "="
142
+ - - ~>
146
143
  - !ruby/object:Gem::Version
147
- hash: 9
144
+ hash: 57
148
145
  segments:
149
146
  - 0
150
- - 0
151
- - 11
152
- version: 0.0.11
147
+ - 1
148
+ - 17
149
+ version: 0.1.17
153
150
  requirement: *id008
154
151
  - !ruby/object:Gem::Dependency
155
152
  type: :runtime
@@ -158,14 +155,14 @@ dependencies:
158
155
  version_requirements: &id009 !ruby/object:Gem::Requirement
159
156
  none: false
160
157
  requirements:
161
- - - ">="
158
+ - - ~>
162
159
  - !ruby/object:Gem::Version
163
- hash: 29
160
+ hash: 19
164
161
  segments:
165
162
  - 0
166
- - 0
167
163
  - 1
168
- version: 0.0.1
164
+ - 4
165
+ version: 0.1.4
169
166
  requirement: *id009
170
167
  description: A software model in Ruby for the greenhouse gas emissions of an automobile
171
168
  email: andy@rossmeissl.net