drewolson-diggr 0.1.3 → 0.1.4
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/diggr/response_classes/topic.rb +1 -7
- data/test/test_topic.rb +2 -11
- metadata +2 -2
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'need'
|
|
3
|
-
need { 'container' }
|
|
4
3
|
|
|
5
4
|
module Diggr
|
|
6
5
|
class Topic
|
|
7
|
-
attr_accessor :name, :short_name
|
|
6
|
+
attr_accessor :name, :short_name
|
|
8
7
|
|
|
9
8
|
def self.new_from_parsed_json(data)
|
|
10
9
|
topic = Topic.new
|
|
11
10
|
topic.name = data['name']
|
|
12
11
|
topic.short_name = data['short_name']
|
|
13
|
-
|
|
14
|
-
if data.has_key? 'container'
|
|
15
|
-
topic.container = Diggr::Container.new_from_parsed_json(data['container'])
|
|
16
|
-
end
|
|
17
|
-
|
|
18
12
|
topic
|
|
19
13
|
end
|
|
20
14
|
end
|
data/test/test_topic.rb
CHANGED
|
@@ -2,7 +2,6 @@ require 'test/unit'
|
|
|
2
2
|
require 'rubygems'
|
|
3
3
|
require 'need'
|
|
4
4
|
need { '../lib/diggr/response_classes/topic' }
|
|
5
|
-
need { '../lib/diggr/response_classes/container' }
|
|
6
5
|
|
|
7
6
|
class TestTopic < Test::Unit::TestCase
|
|
8
7
|
def test_instantiation
|
|
@@ -14,21 +13,13 @@ class TestTopic < Test::Unit::TestCase
|
|
|
14
13
|
def test_new_from_parsed_json
|
|
15
14
|
parsed_json_data = {
|
|
16
15
|
'name' => 'Test Topic',
|
|
17
|
-
'short_name' => 'test'
|
|
18
|
-
'container' => {
|
|
19
|
-
'name' => 'Test Container',
|
|
20
|
-
'short_name' => 'test'
|
|
21
|
-
}
|
|
16
|
+
'short_name' => 'test'
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
topic = Diggr::Topic.new_from_parsed_json(parsed_json_data)
|
|
25
20
|
|
|
26
21
|
parsed_json_data.each do |key,val|
|
|
27
|
-
|
|
28
|
-
assert_instance_of Diggr::Container, topic.container
|
|
29
|
-
else
|
|
30
|
-
assert_equal val, topic.send(key)
|
|
31
|
-
end
|
|
22
|
+
assert_equal val, topic.send(key)
|
|
32
23
|
end
|
|
33
24
|
end
|
|
34
25
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: drewolson-diggr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Drew Olson
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-06-16 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|