flight 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -144,12 +144,12 @@ dependencies:
|
|
144
144
|
requirements:
|
145
145
|
- - "="
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
hash:
|
147
|
+
hash: 19
|
148
148
|
segments:
|
149
149
|
- 0
|
150
150
|
- 0
|
151
|
-
-
|
152
|
-
version: 0.0.
|
151
|
+
- 6
|
152
|
+
version: 0.0.6
|
153
153
|
requirement: *id008
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
type: :runtime
|
@@ -282,7 +282,6 @@ files:
|
|
282
282
|
- lib/flight/summarization.rb
|
283
283
|
- lib/test_support/db/schema.rb
|
284
284
|
- lib/test_support/flight_record.rb
|
285
|
-
- features/step_definitions/carbon_steps.rb
|
286
285
|
- features/support/env.rb
|
287
286
|
- features/flight_committees.feature
|
288
287
|
- features/flight_emissions.feature
|
@@ -321,7 +320,6 @@ signing_key:
|
|
321
320
|
specification_version: 3
|
322
321
|
summary: A carbon model
|
323
322
|
test_files:
|
324
|
-
- features/step_definitions/carbon_steps.rb
|
325
323
|
- features/support/env.rb
|
326
324
|
- features/flight_committees.feature
|
327
325
|
- features/flight_emissions.feature
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
|
3
|
-
Given /^(a flight|it) (has|used) "(.+)" (of\s?)?"(.*)"$/ do |_, __, field, ___, value|
|
4
|
-
@activity_hash ||= {}
|
5
|
-
if value.present?
|
6
|
-
methods = field.split('.')
|
7
|
-
context = @activity_hash
|
8
|
-
methods.each do |method|
|
9
|
-
method = method.to_sym
|
10
|
-
context[method] ||= {}
|
11
|
-
value = Date.parse(value) if value =~ /\d{4}-\d{2}-\d{2}/
|
12
|
-
context[method] = value if method == methods.last.to_sym
|
13
|
-
context = context[method]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Given /^the current date is (.+)$/ do |current_date|
|
19
|
-
@current_date = Time.parse(current_date)
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^emissions are calculated$/ do
|
23
|
-
@activity = FlightRecord.from_params_hash @activity_hash
|
24
|
-
if @current_date
|
25
|
-
Timecop.travel(@current_date) do
|
26
|
-
@emission = @activity.emission Timeframe.this_year
|
27
|
-
end
|
28
|
-
else
|
29
|
-
@emission = @activity.emission Timeframe.this_year
|
30
|
-
end
|
31
|
-
@characteristics = @activity.deliberations[:emission].characteristics
|
32
|
-
end
|
33
|
-
|
34
|
-
Then /^the emission value should be within (\d+) kgs of (\d+)$/ do |cusion, emissions|
|
35
|
-
@emission.should be_close(emissions.to_f, cusion.to_f)
|
36
|
-
end
|
37
|
-
|
38
|
-
Then /^the calculation should have used committees (.*)$/ do |committee_list|
|
39
|
-
committees = committee_list.split(/,\s*/)
|
40
|
-
committees.each do |committee|
|
41
|
-
@characteristics.keys.should include(committee)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
Then /^the (.+) committee should be close to ([^,]+), \+\/-(.+)$/ do |committee, value, cusion|
|
46
|
-
@characteristics[committee.to_sym].to_f.should be_close(value.to_f, cusion.to_f)
|
47
|
-
end
|
48
|
-
|
49
|
-
Then /^the (.+) committee should be exactly (.*)$/ do |committee, value|
|
50
|
-
@characteristics[committee.to_sym].to_s.should == value
|
51
|
-
end
|
52
|
-
|
53
|
-
Then /^the active_subtimeframe committee should have timeframe (.*)$/ do |tf_string|
|
54
|
-
days, start, finish = tf_string.split(/,\s*/)
|
55
|
-
@characteristics[:active_subtimeframe].to_s.should =~ /#{days} days starting #{start} ending #{finish}/
|
56
|
-
end
|
57
|
-
|