pupa 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.travis.yml +5 -0
  4. data/.yardopts +4 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +20 -0
  7. data/README.md +52 -0
  8. data/Rakefile +37 -0
  9. data/USAGE +1 -0
  10. data/lib/pupa/errors.rb +30 -0
  11. data/lib/pupa/logger.rb +37 -0
  12. data/lib/pupa/models/base.rb +190 -0
  13. data/lib/pupa/models/concerns/contactable.rb +34 -0
  14. data/lib/pupa/models/concerns/identifiable.rb +26 -0
  15. data/lib/pupa/models/concerns/linkable.rb +26 -0
  16. data/lib/pupa/models/concerns/nameable.rb +34 -0
  17. data/lib/pupa/models/concerns/sourceable.rb +26 -0
  18. data/lib/pupa/models/concerns/timestamps.rb +22 -0
  19. data/lib/pupa/models/contact_detail_list.rb +28 -0
  20. data/lib/pupa/models/membership.rb +37 -0
  21. data/lib/pupa/models/organization.rb +40 -0
  22. data/lib/pupa/models/person.rb +35 -0
  23. data/lib/pupa/models/post.rb +28 -0
  24. data/lib/pupa/processor/client.rb +42 -0
  25. data/lib/pupa/processor/dependency_graph.rb +18 -0
  26. data/lib/pupa/processor/helper.rb +15 -0
  27. data/lib/pupa/processor/middleware/logger.rb +37 -0
  28. data/lib/pupa/processor/middleware/parse_html.rb +16 -0
  29. data/lib/pupa/processor/persistence.rb +80 -0
  30. data/lib/pupa/processor/yielder.rb +50 -0
  31. data/lib/pupa/processor.rb +351 -0
  32. data/lib/pupa/refinements/faraday_middleware.rb +32 -0
  33. data/lib/pupa/refinements/json-schema.rb +36 -0
  34. data/lib/pupa/runner.rb +185 -0
  35. data/lib/pupa/version.rb +3 -0
  36. data/lib/pupa.rb +31 -0
  37. data/pupa.gemspec +34 -0
  38. data/schemas/popolo/contact_detail.json +44 -0
  39. data/schemas/popolo/identifier.json +18 -0
  40. data/schemas/popolo/link.json +19 -0
  41. data/schemas/popolo/membership.json +86 -0
  42. data/schemas/popolo/organization.json +104 -0
  43. data/schemas/popolo/other_name.json +28 -0
  44. data/schemas/popolo/person.json +130 -0
  45. data/schemas/popolo/post.json +78 -0
  46. data/spec/cassettes/31ac91ccad069eefc07d96cfbe66fa66c1b41fcf.yml +56 -0
  47. data/spec/cassettes/4ff54d737afb5d693653752d7bf234a405a80172.yml +48 -0
  48. data/spec/cassettes/898049a22e6ca51dfa2510d9e0e0207a5c396524.yml +54 -0
  49. data/spec/cassettes/ce69ff734ce852d2bfaa482bbf55d7ffb4762e87.yml +26 -0
  50. data/spec/cassettes/da629b01e0836deda8a5540a4e6a08783dd7aef9.yml +46 -0
  51. data/spec/cassettes/e398f35bea86b3d4c87a6934bae1eb7fca8744f9.yml +26 -0
  52. data/spec/logger_spec.rb +4 -0
  53. data/spec/models/base_spec.rb +194 -0
  54. data/spec/models/concerns/contactable_spec.rb +37 -0
  55. data/spec/models/concerns/identifiable_spec.rb +25 -0
  56. data/spec/models/concerns/linkable_spec.rb +25 -0
  57. data/spec/models/concerns/nameable_spec.rb +25 -0
  58. data/spec/models/concerns/sourceable_spec.rb +25 -0
  59. data/spec/models/concerns/timestamps_spec.rb +32 -0
  60. data/spec/models/contact_detail_list_spec.rb +44 -0
  61. data/spec/models/membership_spec.rb +30 -0
  62. data/spec/models/organization_spec.rb +24 -0
  63. data/spec/models/person_spec.rb +24 -0
  64. data/spec/models/post_spec.rb +19 -0
  65. data/spec/processor/client_spec.rb +4 -0
  66. data/spec/processor/dependency_graph_spec.rb +4 -0
  67. data/spec/processor/helper_spec.rb +4 -0
  68. data/spec/processor/middleware/logger_spec.rb +87 -0
  69. data/spec/processor/middleware/parse_html_spec.rb +92 -0
  70. data/spec/processor/persistence_spec.rb +41 -0
  71. data/spec/processor/yielder_spec.rb +55 -0
  72. data/spec/processor_spec.rb +268 -0
  73. data/spec/runner_spec.rb +85 -0
  74. data/spec/spec_helper.rb +17 -0
  75. metadata +342 -0
@@ -0,0 +1,26 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http:/hello
6
+ body:
7
+ encoding: UTF-8
8
+ string: foo=bar
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.8
12
+ Accept:
13
+ - text/html
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ Content-Type:
20
+ - text/html
21
+ body:
22
+ encoding: UTF-8
23
+ string: hello
24
+ http_version:
25
+ recorded_at: Sun, 15 Sep 2013 22:37:06 GMT
26
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://httpbin.org/get
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.8
12
+ response:
13
+ status:
14
+ code: 200
15
+ message:
16
+ headers:
17
+ access-control-allow-origin:
18
+ - '*'
19
+ content-type:
20
+ - application/json
21
+ date:
22
+ - Sun, 15 Sep 2013 22:37:07 GMT
23
+ server:
24
+ - gunicorn/0.17.4
25
+ content-length:
26
+ - '275'
27
+ connection:
28
+ - Close
29
+ body:
30
+ encoding: UTF-8
31
+ string: |-
32
+ {
33
+ "url": "http://httpbin.org/get",
34
+ "args": {},
35
+ "origin": "70.49.74.123",
36
+ "headers": {
37
+ "Accept": "*/*",
38
+ "User-Agent": "Faraday v0.8.8",
39
+ "Connection": "close",
40
+ "Host": "httpbin.org",
41
+ "Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
42
+ }
43
+ }
44
+ http_version:
45
+ recorded_at: Sun, 15 Sep 2013 22:37:07 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,26 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http:/hello
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.8
12
+ Accept:
13
+ - text/html
14
+ response:
15
+ status:
16
+ code: 200
17
+ message:
18
+ headers:
19
+ Content-Type:
20
+ - text/html
21
+ body:
22
+ encoding: UTF-8
23
+ string: hello
24
+ http_version:
25
+ recorded_at: Sun, 15 Sep 2013 22:37:06 GMT
26
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Pupa::Logger do
4
+ end
@@ -0,0 +1,194 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Base do
4
+ module Music
5
+ class Band < Pupa::Base
6
+ self.schema = {
7
+ '$schema' => 'http://json-schema.org/draft-03/schema#',
8
+ 'properties' => {
9
+ 'url' => {
10
+ 'type' => 'string',
11
+ 'format' => 'uri',
12
+ },
13
+ },
14
+ }
15
+ attr_accessor :name, :url, :label, :founding_date, :inactive, :label_id, :manager_id
16
+ foreign_key :label_id, :manager_id
17
+ foreign_object :label
18
+ end
19
+ end
20
+
21
+ let :properties do
22
+ {name: 'Moderat', url: 'http://moderat.fm/', label: {name: 'Mute'}, inactive: false, manager_id: '1'}
23
+ end
24
+
25
+ let :object do
26
+ Music::Band.new(properties)
27
+ end
28
+
29
+ describe '#attr_accessor' do
30
+ it 'should add properties' do
31
+ Music::Band.properties.to_a.should == [:_id, :_type, :extras, :name, :url, :label, :founding_date, :inactive, :label_id, :manager_id]
32
+ end
33
+ end
34
+
35
+ describe '#foreign_key' do
36
+ it 'should add foreign keys' do
37
+ Music::Band.foreign_keys.to_a.should == [:label_id, :manager_id]
38
+ end
39
+ end
40
+
41
+ describe '#foreign_object' do
42
+ it 'should add foreign objects' do
43
+ Music::Band.foreign_objects.to_a.should == [:label]
44
+ end
45
+ end
46
+
47
+ describe '#schema=' do
48
+ let :klass_with_absolute_path do
49
+ Class.new(Pupa::Base) do
50
+ self.schema = '/path/to/schema.json'
51
+ end
52
+ end
53
+
54
+ let :klass_with_relative_path do
55
+ Class.new(Pupa::Base) do
56
+ self.schema = 'schema'
57
+ end
58
+ end
59
+
60
+ it 'should accept a hash' do
61
+ Music::Band.json_schema.should == {
62
+ '$schema' => 'http://json-schema.org/draft-03/schema#',
63
+ 'properties' => {
64
+ 'url' => {
65
+ 'type' => 'string',
66
+ 'format' => 'uri',
67
+ },
68
+ },
69
+ }
70
+ end
71
+
72
+ it 'should accept an absolute path' do
73
+ klass_with_absolute_path.json_schema.should == '/path/to/schema.json'
74
+ end
75
+
76
+ it 'should accept a relative path' do
77
+ klass_with_relative_path.json_schema.should == File.expand_path(File.join('..', '..', 'schemas', 'schema.json'), __dir__)
78
+ end
79
+ end
80
+
81
+ describe '#initialize' do
82
+ it 'should set the _type' do
83
+ object._type.should == 'music/band'
84
+ end
85
+
86
+ it 'should set the _id' do
87
+ object._id.should match(/\A[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\z/)
88
+ end
89
+
90
+ it 'should set properties' do
91
+ object.name.should == 'Moderat'
92
+ object.url.should == 'http://moderat.fm/'
93
+ end
94
+ end
95
+
96
+ describe '#[]' do
97
+ it 'should get a property' do
98
+ object[:name].should == 'Moderat'
99
+ end
100
+
101
+ it 'should raise an error if the class is missing the property' do
102
+ expect{object[:nonexistent]}.to raise_error(Pupa::Errors::MissingAttributeError)
103
+ end
104
+ end
105
+
106
+ describe '#[]=' do
107
+ it 'should set a property' do
108
+ object[:name] = 'Apparat'
109
+ object[:name].should == 'Apparat'
110
+ end
111
+
112
+ it 'should raise an error if the class is missing the property' do
113
+ expect{object[:nonexistent] = 1}.to raise_error(Pupa::Errors::MissingAttributeError)
114
+ end
115
+ end
116
+
117
+ describe '#_id=' do
118
+ it 'should set the _id' do
119
+ object._id = '1'
120
+ object._id.should == '1'
121
+ end
122
+
123
+ it 'should coerce the _id to a string' do
124
+ object._id = Moped::BSON::ObjectId.new
125
+ object._id.should be_a(String)
126
+ end
127
+ end
128
+
129
+ describe '#add_extra' do
130
+ it 'should add an extra property' do
131
+ object.add_extra(:age, 10)
132
+ object.extras.should == {age: 10}
133
+ end
134
+ end
135
+
136
+ describe '#fingerprint' do
137
+ it 'should return the fingerprint' do
138
+ object.fingerprint.should == {_type: 'music/band', name: 'Moderat', url: 'http://moderat.fm/', inactive: false, manager_id: '1'}
139
+ end
140
+ end
141
+
142
+ describe '#foreign_properties' do
143
+ it 'should return the foreign keys and foreign objects' do
144
+ object.foreign_properties.should == {label: {name: 'Mute'}, manager_id: '1'}
145
+ end
146
+ end
147
+
148
+ describe '#validate!' do
149
+ let :klass_without_schema do
150
+ Class.new(Pupa::Base)
151
+ end
152
+
153
+ it 'should do nothing if the schema is not set' do
154
+ klass_without_schema.new.validate!.should == nil
155
+ end
156
+
157
+ it 'should return true if the object is valid' do
158
+ object.validate!.should == true
159
+ end
160
+
161
+ it 'should raise an error if the object is invalid' do
162
+ object[:url] = 'invalid'
163
+ expect{object.validate!}.to raise_error(JSON::Schema::ValidationError)
164
+ end
165
+ end
166
+
167
+ describe '#to_h' do
168
+ it 'should not include foreign objects by default' do
169
+ object.to_h.should == {_id: object._id, _type: 'music/band', name: 'Moderat', url: 'http://moderat.fm/', inactive: false, manager_id: '1'}
170
+ end
171
+
172
+ it 'should include foreign objects if desired' do
173
+ object.to_h(include_foreign_objects: true).should == {_id: object._id, _type: 'music/band', name: 'Moderat', url: 'http://moderat.fm/', label: {name: 'Mute'}, inactive: false, manager_id: '1'}
174
+ end
175
+
176
+ it 'should not include blank properties' do
177
+ object.to_h.should_not have_key(:founding_date)
178
+ end
179
+
180
+ it 'should include false properties' do
181
+ object.to_h.should have_key(:inactive)
182
+ end
183
+ end
184
+
185
+ describe '#==' do
186
+ it 'should return true if two objects are equal' do
187
+ object.should == Music::Band.new(properties)
188
+ end
189
+
190
+ it 'should return false if two objects are unequal' do
191
+ object.should_not == Music::Band.new(properties.merge(name: 'Apparat'))
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,37 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Contactable do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Contactable
7
+ end
8
+ end
9
+
10
+ let :object do
11
+ klass.new
12
+ end
13
+
14
+ describe '#contact_details=' do
15
+ it 'should use coerce to a ContactDetailList' do
16
+ object.contact_details = [{type: 'email', value: 'ceo@example.com', note: 'work'}]
17
+ object.contact_details.should be_a(Pupa::ContactDetailList)
18
+ end
19
+ end
20
+
21
+ describe '#add_contact_detail' do
22
+ it 'should add a contact detail' do
23
+ object.add_contact_detail('email', 'ceo@example.com', note: 'work')
24
+ object.contact_details.should == [{type: 'email', value: 'ceo@example.com', note: 'work'}]
25
+ end
26
+
27
+ it 'should not add a contact detail without a type' do
28
+ object.add_contact_detail('email', nil)
29
+ object.contact_details.blank?.should == true
30
+ end
31
+
32
+ it 'should not add a contact detail without a value' do
33
+ object.add_contact_detail(nil, 'ceo@example.com')
34
+ object.contact_details.blank?.should == true
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Identifiable do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Identifiable
7
+ end
8
+ end
9
+
10
+ let :object do
11
+ klass.new
12
+ end
13
+
14
+ describe '#add_identifier' do
15
+ it 'should add an identifier' do
16
+ object.add_identifier('123456789', scheme: 'duns')
17
+ object.identifiers.should == [{identifier: '123456789', scheme: 'duns'}]
18
+ end
19
+
20
+ it 'should not add an identifier without an identifier' do
21
+ object.add_identifier(nil)
22
+ object.identifiers.blank?.should == true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Linkable do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Linkable
7
+ end
8
+ end
9
+
10
+ let :object do
11
+ klass.new
12
+ end
13
+
14
+ describe '#add_link' do
15
+ it 'should add a link' do
16
+ object.add_link('http://example.com', note: 'homepage')
17
+ object.links.should == [{url: 'http://example.com', note: 'homepage'}]
18
+ end
19
+
20
+ it 'should not add a link without a url' do
21
+ object.add_link(nil)
22
+ object.links.blank?.should == true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Nameable do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Nameable
7
+ end
8
+ end
9
+
10
+ let :object do
11
+ klass.new
12
+ end
13
+
14
+ describe '#add_name' do
15
+ it 'should add a name' do
16
+ object.add_name('Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', note: 'Birth name')
17
+ object.other_names.should == [{name: 'Mr. Ziggy Q. Public, Esq.', start_date: '1920-01', end_date: '1949-12-31', note: 'Birth name'}]
18
+ end
19
+
20
+ it 'should not add a name without a name' do
21
+ object.add_name(nil)
22
+ object.other_names.blank?.should == true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Sourceable do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Sourceable
7
+ end
8
+ end
9
+
10
+ let :object do
11
+ klass.new
12
+ end
13
+
14
+ describe '#add_source' do
15
+ it 'should add a source' do
16
+ object.add_source('http://example.com', note: 'homepage')
17
+ object.sources.should == [{url: 'http://example.com', note: 'homepage'}]
18
+ end
19
+
20
+ it 'should not add a source without a url' do
21
+ object.add_source(nil)
22
+ object.sources.blank?.should == true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Pupa::Concerns::Timestamps do
4
+ let :klass do
5
+ Class.new(Pupa::Base) do
6
+ include Pupa::Concerns::Timestamps
7
+
8
+ def save
9
+ run_callbacks(:save) do
10
+ unless created_at
11
+ run_callbacks(:create) do
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ it 'should set created_at and updated_at on create' do
20
+ object = klass.new
21
+ object.save
22
+ object.created_at.should be_within(1).of(Time.now.utc)
23
+ object.updated_at.should be_within(1).of(Time.now.utc)
24
+ end
25
+
26
+ it 'should set updated_at on save' do
27
+ object = klass.new(created_at: Time.new(2000))
28
+ object.save
29
+ object.created_at.should == Time.new(2000)
30
+ object.updated_at.should be_within(1).of(Time.now.utc)
31
+ end
32
+ end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::ContactDetailList do
4
+ let :object do
5
+ Pupa::ContactDetailList.new([
6
+ {
7
+ type: 'address',
8
+ value: 'first',
9
+ },
10
+ {
11
+ type: 'address',
12
+ value: 'second',
13
+ },
14
+ {
15
+ type: 'email',
16
+ value: 'first',
17
+ },
18
+ {
19
+ type: 'email',
20
+ value: 'second',
21
+ },
22
+ ])
23
+ end
24
+
25
+ describe '#address' do
26
+ it 'should return the first postal address' do
27
+ object.address.should == 'first'
28
+ end
29
+
30
+ it 'should return nil if no postal addresses' do
31
+ Pupa::ContactDetailList.new.address.should == nil
32
+ end
33
+ end
34
+
35
+ describe '#email' do
36
+ it 'should return the first email address' do
37
+ object.email.should == 'first'
38
+ end
39
+
40
+ it 'should return nil if no email addresses' do
41
+ Pupa::ContactDetailList.new.email.should == nil
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,30 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Membership do
4
+ let :object do
5
+ Pupa::Membership.new({
6
+ label: "Kitchen assistant at Joe's Diner",
7
+ person_id: 'john-q-public',
8
+ organization_id: 'abc-inc',
9
+ post_id: 'abc-inc-kitchen-assistant',
10
+ end_date: '1971-12-31',
11
+ })
12
+ end
13
+
14
+ describe '#to_s' do
15
+ it 'should return a human-readable string' do
16
+ object.to_s.should == 'john-q-public in abc-inc'
17
+ end
18
+ end
19
+
20
+ describe '#fingerprint' do
21
+ it 'should return the fingerprint' do
22
+ object.fingerprint.should == {
23
+ '$or' => [
24
+ {label: "Kitchen assistant at Joe's Diner", person_id: 'john-q-public', organization_id: 'abc-inc', end_date: '1971-12-31'},
25
+ {person_id: 'john-q-public', organization_id: 'abc-inc', post_id: 'abc-inc-kitchen-assistant', end_date: '1971-12-31'},
26
+ ],
27
+ }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Organization do
4
+ let :object do
5
+ Pupa::Organization.new(name: 'ABC, Inc.', classification: 'Corporation', parent_id: 'holding-company-corp')
6
+ end
7
+
8
+ describe '#to_s' do
9
+ it 'should return a human-readable string' do
10
+ object.to_s.should == 'ABC, Inc.'
11
+ end
12
+ end
13
+
14
+ describe '#fingerprint' do
15
+ it 'should return the fingerprint' do
16
+ object.fingerprint.should == {
17
+ '$or' => [
18
+ {'name' => 'ABC, Inc.', classification: 'Corporation', parent_id: 'holding-company-corp'},
19
+ {'other_names.name' => 'ABC, Inc.', classification: 'Corporation', parent_id: 'holding-company-corp'},
20
+ ],
21
+ }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Person do
4
+ let :object do
5
+ Pupa::Person.new(name: 'Mr. John Q. Public, Esq.')
6
+ end
7
+
8
+ describe '#to_s' do
9
+ it 'should return a human-readable string' do
10
+ object.to_s.should == 'Mr. John Q. Public, Esq.'
11
+ end
12
+ end
13
+
14
+ describe '#fingerprint' do
15
+ it 'should return the fingerprint' do
16
+ object.fingerprint.should == {
17
+ '$or' => [
18
+ {'name' => 'Mr. John Q. Public, Esq.'},
19
+ {'other_names.name' => 'Mr. John Q. Public, Esq.'},
20
+ ],
21
+ }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Post do
4
+ let :object do
5
+ Pupa::Post.new(label: 'Chef', organization_id: 'abc-inc', end_date: '2010')
6
+ end
7
+
8
+ describe '#to_s' do
9
+ it 'should return a human-readable string' do
10
+ object.to_s.should == 'Chef in abc-inc'
11
+ end
12
+ end
13
+
14
+ describe '#fingerprint' do
15
+ it 'should return the fingerprint' do
16
+ object.fingerprint.should == {label: 'Chef', organization_id: 'abc-inc', end_date: '2010'}
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Processor::Client do
4
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Processor::DependencyGraph do
4
+ end
@@ -0,0 +1,4 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Pupa::Processor::Helper do
4
+ end