bus_trip 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,27 +2,32 @@ Feature: Bus Trip Committee Calculations
|
|
2
2
|
The bus trip model should generate correct committee calculations
|
3
3
|
|
4
4
|
Scenario Outline: Distance from duration, distance estimate, and bus class
|
5
|
-
Given a bus trip
|
6
|
-
And
|
7
|
-
And
|
8
|
-
|
9
|
-
|
5
|
+
Given a bus trip emitter
|
6
|
+
And a characteristic "distance_estimate" of "<distance_estimate>"
|
7
|
+
And a characteristic "duration" of "<duration>"
|
8
|
+
And a characteristic "bus_class.name" of "<bus_class>"
|
9
|
+
When the "bus_class" committee is calculated
|
10
|
+
And the "distance" committee is calculated
|
11
|
+
Then the conclusion of the committee should be "<distance>"
|
10
12
|
Examples:
|
11
13
|
| duration | distance_estimate | bus_class | distance |
|
12
|
-
| 40 | | |
|
14
|
+
| 40 | | | 8 |
|
13
15
|
| | 60 | | 60 |
|
14
|
-
| | | regional coach |
|
16
|
+
| | | regional coach | 8 |
|
15
17
|
| | | city transit | 8 |
|
16
18
|
|
17
19
|
Scenario Outline: Diesel consumed from distance and diesel intensity
|
18
|
-
Given a bus trip
|
19
|
-
And
|
20
|
-
And
|
21
|
-
|
22
|
-
|
20
|
+
Given a bus trip emitter
|
21
|
+
And a characteristic "distance_estimate" of "<distance_estimate>"
|
22
|
+
And a characteristic "duration" of "<duration>"
|
23
|
+
And a characteristic "bus_class.name" of "<bus_class>"
|
24
|
+
When the "distance" committee is calculated
|
25
|
+
And the "diesel_intensity" committee is calculated
|
26
|
+
And the "diesel_consumed" committee is calculated
|
27
|
+
Then the conclusion of the committee should be "<diesel_consumed>"
|
23
28
|
Examples:
|
24
29
|
| duration | distance_estimate | bus_class | diesel_consumed |
|
25
|
-
| 40 | |
|
26
|
-
| | 60 |
|
27
|
-
| | | regional coach |
|
28
|
-
| | | city transit |
|
30
|
+
| 40 | | regional coach | 5.03461 |
|
31
|
+
| | 60 | city transit | 25.40316 |
|
32
|
+
| | | regional coach | 5.03461 |
|
33
|
+
| | | city transit | 3.04574 |
|
@@ -5,7 +5,7 @@ Feature: Bus Trip Emissions Calculations
|
|
5
5
|
Given a bus trip has "distance_estimate" of "<distance>"
|
6
6
|
And it has "timeframe" of "<timeframe>"
|
7
7
|
When emissions are calculated
|
8
|
-
Then the emission value should be within 0.1 kgs of <emission>
|
8
|
+
Then the emission value should be within "0.1" kgs of "<emission>"
|
9
9
|
Examples:
|
10
10
|
| timeframe | distance | emission |
|
11
11
|
| 2010-08-01/2010-08-01 | 10 | 1.2 |
|
@@ -13,10 +13,10 @@ Feature: Bus Trip Emissions Calculations
|
|
13
13
|
|
14
14
|
Scenario Outline: Standard Calculations for bus trips with timeframe and bus class
|
15
15
|
Given a bus trip has "distance_estimate" of "<distance>"
|
16
|
-
And it has "bus_class.name" "<bus_class>"
|
16
|
+
And it has "bus_class.name" of "<bus_class>"
|
17
17
|
And it has "timeframe" of "<timeframe>"
|
18
18
|
When emissions are calculated
|
19
|
-
Then the emission value should be within 0.1 kgs of <emission>
|
19
|
+
Then the emission value should be within "0.1" kgs of "<emission>"
|
20
20
|
Examples:
|
21
21
|
| timeframe | distance | bus_class | emission |
|
22
22
|
| 2010-08-01/2010-08-01 | 10 | city transit | 3.4 |
|
@@ -24,13 +24,13 @@ Feature: Bus Trip Emissions Calculations
|
|
24
24
|
|
25
25
|
Scenario Outline: Calculations involving fuel types
|
26
26
|
Given a bus trip has "distance_estimate" of "<distance>"
|
27
|
-
And it
|
28
|
-
And it
|
29
|
-
And it
|
30
|
-
And it has "bus_class.passengers" "<passengers>"
|
31
|
-
And it has "bus_class.name" "<bus_class>"
|
27
|
+
And it has "bus_class.gasoline_intensity" of "<gasoline>"
|
28
|
+
And it has "bus_class.diesel_intensity" of "<diesel>"
|
29
|
+
And it has "bus_class.alternative_fuels_intensity" of "<alternative>"
|
30
|
+
And it has "bus_class.passengers" of "<passengers>"
|
31
|
+
And it has "bus_class.name" of "<bus_class>"
|
32
32
|
When emissions are calculated
|
33
|
-
Then the emission value should be within 0.1 kgs of <emission>
|
33
|
+
Then the emission value should be within "0.1" kgs of "<emission>"
|
34
34
|
Examples:
|
35
35
|
| gasoline | diesel | alternative | passengers | distance | bus_class | emission |
|
36
36
|
| 40 | | | 25 | 328 | regional coach | 41.8 |
|
@@ -1,16 +1,12 @@
|
|
1
|
-
require 'characterizable'
|
2
|
-
|
3
1
|
module BrighterPlanet
|
4
2
|
module BusTrip
|
5
3
|
module Characterization
|
6
4
|
def self.included(base)
|
7
|
-
base.send :include, Characterizable
|
8
5
|
base.characterize do
|
9
6
|
has :bus_class
|
10
7
|
has :duration # measures time in minutes
|
11
8
|
has :distance_estimate, :trumps => :duration, :measures => :length
|
12
9
|
end
|
13
|
-
base.add_implicit_characteristics
|
14
10
|
end
|
15
11
|
end
|
16
12
|
end
|
data/lib/bus_trip/data.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
require 'summary_judgement'
|
2
|
-
|
3
1
|
module BrighterPlanet
|
4
2
|
module BusTrip
|
5
3
|
module Summarization
|
6
4
|
def self.included(base)
|
7
|
-
base.extend SummaryJudgement
|
8
5
|
base.summarize do |has|
|
9
6
|
has.adjective lambda { |bus_trip| "#{bus_trip.distance_estimate_in_miles.adaptive_round(1)}-mile" }, :if => :distance_estimate
|
10
7
|
has.adjective lambda { |bus_trip| "#{bus_trip.duration}-minute" }, :if => :duration
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bus_trip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 11
|
10
|
+
version: 0.0.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -19,13 +19,14 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2010-09-
|
22
|
+
date: 2010-09-22 00:00:00 -04:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
|
26
|
+
type: :development
|
27
27
|
prerelease: false
|
28
|
-
|
28
|
+
name: activerecord
|
29
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
29
30
|
none: false
|
30
31
|
requirements:
|
31
32
|
- - ~>
|
@@ -36,12 +37,12 @@ dependencies:
|
|
36
37
|
- 0
|
37
38
|
- 0
|
38
39
|
version: 3.0.0
|
39
|
-
|
40
|
-
version_requirements: *id001
|
40
|
+
requirement: *id001
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
|
42
|
+
type: :development
|
43
43
|
prerelease: false
|
44
|
-
|
44
|
+
name: bundler
|
45
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
45
46
|
none: false
|
46
47
|
requirements:
|
47
48
|
- - ~>
|
@@ -51,12 +52,12 @@ dependencies:
|
|
51
52
|
- 1
|
52
53
|
- 0
|
53
54
|
version: "1.0"
|
54
|
-
|
55
|
-
version_requirements: *id002
|
55
|
+
requirement: *id002
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
|
57
|
+
type: :development
|
58
58
|
prerelease: false
|
59
|
-
|
59
|
+
name: cucumber
|
60
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
60
61
|
none: false
|
61
62
|
requirements:
|
62
63
|
- - "="
|
@@ -67,12 +68,12 @@ dependencies:
|
|
67
68
|
- 8
|
68
69
|
- 3
|
69
70
|
version: 0.8.3
|
70
|
-
|
71
|
-
version_requirements: *id003
|
71
|
+
requirement: *id003
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
|
73
|
+
type: :development
|
74
74
|
prerelease: false
|
75
|
-
|
75
|
+
name: jeweler
|
76
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
76
77
|
none: false
|
77
78
|
requirements:
|
78
79
|
- - "="
|
@@ -83,12 +84,12 @@ dependencies:
|
|
83
84
|
- 4
|
84
85
|
- 0
|
85
86
|
version: 1.4.0
|
86
|
-
|
87
|
-
version_requirements: *id004
|
87
|
+
requirement: *id004
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
|
-
|
89
|
+
type: :development
|
90
90
|
prerelease: false
|
91
|
-
|
91
|
+
name: rake
|
92
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
92
93
|
none: false
|
93
94
|
requirements:
|
94
95
|
- - ">="
|
@@ -97,12 +98,12 @@ dependencies:
|
|
97
98
|
segments:
|
98
99
|
- 0
|
99
100
|
version: "0"
|
100
|
-
|
101
|
-
version_requirements: *id005
|
101
|
+
requirement: *id005
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
|
-
|
103
|
+
type: :development
|
104
104
|
prerelease: false
|
105
|
-
|
105
|
+
name: rdoc
|
106
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
106
107
|
none: false
|
107
108
|
requirements:
|
108
109
|
- - ">="
|
@@ -111,12 +112,12 @@ dependencies:
|
|
111
112
|
segments:
|
112
113
|
- 0
|
113
114
|
version: "0"
|
114
|
-
|
115
|
-
version_requirements: *id006
|
115
|
+
requirement: *id006
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
|
-
|
117
|
+
type: :development
|
118
118
|
prerelease: false
|
119
|
-
|
119
|
+
name: rspec
|
120
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
120
121
|
none: false
|
121
122
|
requirements:
|
122
123
|
- - "="
|
@@ -129,40 +130,39 @@ dependencies:
|
|
129
130
|
- beta
|
130
131
|
- 17
|
131
132
|
version: 2.0.0.beta.17
|
132
|
-
|
133
|
-
version_requirements: *id007
|
133
|
+
requirement: *id007
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
|
-
|
135
|
+
type: :development
|
136
136
|
prerelease: false
|
137
|
-
|
137
|
+
name: sniff
|
138
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
138
139
|
none: false
|
139
140
|
requirements:
|
140
141
|
- - ~>
|
141
142
|
- !ruby/object:Gem::Version
|
142
|
-
hash:
|
143
|
+
hash: 57
|
143
144
|
segments:
|
144
145
|
- 0
|
145
146
|
- 1
|
146
|
-
-
|
147
|
-
version: 0.1.
|
148
|
-
|
149
|
-
version_requirements: *id008
|
147
|
+
- 17
|
148
|
+
version: 0.1.17
|
149
|
+
requirement: *id008
|
150
150
|
- !ruby/object:Gem::Dependency
|
151
|
-
|
151
|
+
type: :runtime
|
152
152
|
prerelease: false
|
153
|
-
|
153
|
+
name: emitter
|
154
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
154
155
|
none: false
|
155
156
|
requirements:
|
156
157
|
- - ~>
|
157
158
|
- !ruby/object:Gem::Version
|
158
|
-
hash:
|
159
|
+
hash: 19
|
159
160
|
segments:
|
160
161
|
- 0
|
161
|
-
-
|
162
|
-
-
|
163
|
-
version: 0.
|
164
|
-
|
165
|
-
version_requirements: *id009
|
162
|
+
- 1
|
163
|
+
- 4
|
164
|
+
version: 0.1.4
|
165
|
+
requirement: *id009
|
166
166
|
description: A software model in Ruby for the greenhouse gas emissions of a bus trip
|
167
167
|
email: andy@rossmeissl.net
|
168
168
|
executables: []
|