sandy 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sandy/area.rb +1 -1
- data/lib/sandy/providers/coned/report.rb +1 -2
- data/lib/sandy/version.rb +1 -1
- data/spec/area_spec.rb +19 -11
- data/spec/providers/coned/report_spec.rb +4 -2
- metadata +2 -2
data/lib/sandy/area.rb
CHANGED
@@ -31,7 +31,7 @@ module Sandy
|
|
31
31
|
"total_customers" => @total_customers,
|
32
32
|
"latitude" => @latitude,
|
33
33
|
"longitude" => @longitude,
|
34
|
-
"estimated_recovery_time" => @
|
34
|
+
"estimated_recovery_time" => @estimated_recovery_time,
|
35
35
|
"children" => @children }.to_json
|
36
36
|
end
|
37
37
|
end
|
data/lib/sandy/version.rb
CHANGED
data/spec/area_spec.rb
CHANGED
@@ -16,17 +16,25 @@ describe Sandy::Area do
|
|
16
16
|
|
17
17
|
describe "#to_json" do
|
18
18
|
let(:parent) { Sandy::Area.new(0, "Manhattan") }
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
let(:current) { Sandy::Area.new(customers_affected, "Downtown",
|
20
|
+
{ parent: parent }) }
|
21
|
+
let(:child) { Sandy::Area.new(0, "Battery Park", { parent: current }) }
|
22
|
+
let(:json) { current.to_json }
|
23
|
+
|
24
|
+
it "parses with the correct values" do
|
25
|
+
JSON.parse(json).should == {"name" => "Downtown",
|
26
|
+
"customers_affected" => customers_affected,
|
27
|
+
"parent" => "Manhattan",
|
28
|
+
"total_customers" => nil,
|
29
|
+
"latitude" => nil,
|
30
|
+
"longitude" => nil,
|
31
|
+
"estimated_recovery_time" => nil,
|
32
|
+
"children" => [] }
|
33
|
+
end
|
34
|
+
|
35
|
+
it "renders only the name for the parent field" do
|
36
|
+
JSON.parse(json)["parent"].should == "Manhattan"
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
40
|
context "with an area name" do
|
@@ -11,8 +11,10 @@ describe Sandy::Provider::ConEd::Report do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "#to_json" do
|
14
|
-
|
15
|
-
|
14
|
+
subject {}
|
15
|
+
it 'has areas' do
|
16
|
+
json = JSON.parse(Sandy::Provider::ConEd::Report.new.to_json)
|
17
|
+
json["report"]["areas"].should_not be_empty
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sandy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|