kdonovan-happymapper 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,422 @@
1
+ <statuses type="array">
2
+ <status>
3
+ <created_at>Sat Aug 09 05:38:12 +0000 2008</created_at>
4
+ <id>882281424</id>
5
+ <text>I so just thought the guy lighting the Olympic torch was falling when he began to run on the wall. Wow that would have been catastrophic.</text>
6
+ <source>web</source>
7
+ <truncated>false</truncated>
8
+ <in_reply_to_status_id>1234</in_reply_to_status_id>
9
+ <in_reply_to_user_id>12345</in_reply_to_user_id>
10
+ <favorited></favorited>
11
+ <user>
12
+ <id>4243</id>
13
+ <name>John Nunemaker</name>
14
+ <screen_name>jnunemaker</screen_name>
15
+ <location>Mishawaka, IN, US</location>
16
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
17
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
18
+ <url>http://addictedtonew.com</url>
19
+ <protected>false</protected>
20
+ <followers_count>486</followers_count>
21
+ </user>
22
+ </status>
23
+ <status>
24
+ <created_at>Sat Aug 09 02:04:56 +0000 2008</created_at>
25
+ <id>882145663</id>
26
+ <text>@ijonas - wow that stuff sounds sweet</text>
27
+ <source>web</source>
28
+ <truncated>false</truncated>
29
+ <in_reply_to_status_id>882005142</in_reply_to_status_id>
30
+ <in_reply_to_user_id>1000471</in_reply_to_user_id>
31
+ <favorited></favorited>
32
+ <user>
33
+ <id>4243</id>
34
+ <name>John Nunemaker</name>
35
+ <screen_name>jnunemaker</screen_name>
36
+ <location>Mishawaka, IN, US</location>
37
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
38
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
39
+ <url>http://addictedtonew.com</url>
40
+ <protected>false</protected>
41
+ <followers_count>486</followers_count>
42
+ </user>
43
+ </status>
44
+ <status>
45
+ <created_at>Sat Aug 09 01:36:41 +0000 2008</created_at>
46
+ <id>882126691</id>
47
+ <text>Steph is driving Sally for the first time. I'm proud of her.</text>
48
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
49
+ <truncated>false</truncated>
50
+ <in_reply_to_status_id></in_reply_to_status_id>
51
+ <in_reply_to_user_id></in_reply_to_user_id>
52
+ <favorited></favorited>
53
+ <user>
54
+ <id>4243</id>
55
+ <name>John Nunemaker</name>
56
+ <screen_name>jnunemaker</screen_name>
57
+ <location>Mishawaka, IN, US</location>
58
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
59
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
60
+ <url>http://addictedtonew.com</url>
61
+ <protected>false</protected>
62
+ <followers_count>486</followers_count>
63
+ </user>
64
+ </status>
65
+ <status>
66
+ <created_at>Fri Aug 08 22:21:21 +0000 2008</created_at>
67
+ <id>881987762</id>
68
+ <text>@ijonas - what are you making with couchdb, ruby and httparty?</text>
69
+ <source>web</source>
70
+ <truncated>false</truncated>
71
+ <in_reply_to_status_id>881947237</in_reply_to_status_id>
72
+ <in_reply_to_user_id>1000471</in_reply_to_user_id>
73
+ <favorited></favorited>
74
+ <user>
75
+ <id>4243</id>
76
+ <name>John Nunemaker</name>
77
+ <screen_name>jnunemaker</screen_name>
78
+ <location>Mishawaka, IN, US</location>
79
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
80
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
81
+ <url>http://addictedtonew.com</url>
82
+ <protected>false</protected>
83
+ <followers_count>486</followers_count>
84
+ </user>
85
+ </status>
86
+ <status>
87
+ <created_at>Fri Aug 08 14:20:14 +0000 2008</created_at>
88
+ <id>881535796</id>
89
+ <text>@oaknd1 - delete it off phone and iTunes.</text>
90
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
91
+ <truncated>false</truncated>
92
+ <in_reply_to_status_id>881526234</in_reply_to_status_id>
93
+ <in_reply_to_user_id>3038211</in_reply_to_user_id>
94
+ <favorited></favorited>
95
+ <user>
96
+ <id>4243</id>
97
+ <name>John Nunemaker</name>
98
+ <screen_name>jnunemaker</screen_name>
99
+ <location>Mishawaka, IN, US</location>
100
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
101
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
102
+ <url>http://addictedtonew.com</url>
103
+ <protected>false</protected>
104
+ <followers_count>486</followers_count>
105
+ </user>
106
+ </status>
107
+ <status>
108
+ <created_at>Fri Aug 08 14:07:29 +0000 2008</created_at>
109
+ <id>881522394</id>
110
+ <text>Listening to U2 "beautiful day" in honor of it being such a beautiful day.</text>
111
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
112
+ <truncated>false</truncated>
113
+ <in_reply_to_status_id></in_reply_to_status_id>
114
+ <in_reply_to_user_id></in_reply_to_user_id>
115
+ <favorited></favorited>
116
+ <user>
117
+ <id>4243</id>
118
+ <name>John Nunemaker</name>
119
+ <screen_name>jnunemaker</screen_name>
120
+ <location>Mishawaka, IN, US</location>
121
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
122
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
123
+ <url>http://addictedtonew.com</url>
124
+ <protected>false</protected>
125
+ <followers_count>486</followers_count>
126
+ </user>
127
+ </status>
128
+ <status>
129
+ <created_at>Fri Aug 08 14:06:44 +0000 2008</created_at>
130
+ <id>881521592</id>
131
+ <text>@lizsmc1 - hi! (just passed her on the road)</text>
132
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
133
+ <truncated>false</truncated>
134
+ <in_reply_to_status_id>881519558</in_reply_to_status_id>
135
+ <in_reply_to_user_id>11485452</in_reply_to_user_id>
136
+ <favorited></favorited>
137
+ <user>
138
+ <id>4243</id>
139
+ <name>John Nunemaker</name>
140
+ <screen_name>jnunemaker</screen_name>
141
+ <location>Mishawaka, IN, US</location>
142
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
143
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
144
+ <url>http://addictedtonew.com</url>
145
+ <protected>false</protected>
146
+ <followers_count>486</followers_count>
147
+ </user>
148
+ </status>
149
+ <status>
150
+ <created_at>Fri Aug 08 13:59:35 +0000 2008</created_at>
151
+ <id>881514030</id>
152
+ <text>Beautiful day for a motorcycle ride.</text>
153
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
154
+ <truncated>false</truncated>
155
+ <in_reply_to_status_id></in_reply_to_status_id>
156
+ <in_reply_to_user_id></in_reply_to_user_id>
157
+ <favorited></favorited>
158
+ <user>
159
+ <id>4243</id>
160
+ <name>John Nunemaker</name>
161
+ <screen_name>jnunemaker</screen_name>
162
+ <location>Mishawaka, IN, US</location>
163
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
164
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
165
+ <url>http://addictedtonew.com</url>
166
+ <protected>false</protected>
167
+ <followers_count>486</followers_count>
168
+ </user>
169
+ </status>
170
+ <status>
171
+ <created_at>Fri Aug 08 13:45:21 +0000 2008</created_at>
172
+ <id>881499439</id>
173
+ <text>@lizamc1 - no way! Politos will be missed. I remember eating a whole garlic pizza there with Joe.</text>
174
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
175
+ <truncated>false</truncated>
176
+ <in_reply_to_status_id></in_reply_to_status_id>
177
+ <in_reply_to_user_id></in_reply_to_user_id>
178
+ <favorited></favorited>
179
+ <user>
180
+ <id>4243</id>
181
+ <name>John Nunemaker</name>
182
+ <screen_name>jnunemaker</screen_name>
183
+ <location>Mishawaka, IN, US</location>
184
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
185
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
186
+ <url>http://addictedtonew.com</url>
187
+ <protected>false</protected>
188
+ <followers_count>486</followers_count>
189
+ </user>
190
+ </status>
191
+ <status>
192
+ <created_at>Fri Aug 08 13:41:50 +0000 2008</created_at>
193
+ <id>881496024</id>
194
+ <text>Riding my motorcyle to campus. Using the library basement for a meeting.</text>
195
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
196
+ <truncated>false</truncated>
197
+ <in_reply_to_status_id></in_reply_to_status_id>
198
+ <in_reply_to_user_id></in_reply_to_user_id>
199
+ <favorited></favorited>
200
+ <user>
201
+ <id>4243</id>
202
+ <name>John Nunemaker</name>
203
+ <screen_name>jnunemaker</screen_name>
204
+ <location>Mishawaka, IN, US</location>
205
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
206
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
207
+ <url>http://addictedtonew.com</url>
208
+ <protected>false</protected>
209
+ <followers_count>486</followers_count>
210
+ </user>
211
+ </status>
212
+ <status>
213
+ <created_at>Thu Aug 07 22:52:20 +0000 2008</created_at>
214
+ <id>880896190</id>
215
+ <text>Scraping super glue off my finger with a knife.</text>
216
+ <source>web</source>
217
+ <truncated>false</truncated>
218
+ <in_reply_to_status_id></in_reply_to_status_id>
219
+ <in_reply_to_user_id></in_reply_to_user_id>
220
+ <favorited></favorited>
221
+ <user>
222
+ <id>4243</id>
223
+ <name>John Nunemaker</name>
224
+ <screen_name>jnunemaker</screen_name>
225
+ <location>Mishawaka, IN, US</location>
226
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
227
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
228
+ <url>http://addictedtonew.com</url>
229
+ <protected>false</protected>
230
+ <followers_count>486</followers_count>
231
+ </user>
232
+ </status>
233
+ <status>
234
+ <created_at>Thu Aug 07 22:14:35 +0000 2008</created_at>
235
+ <id>880866160</id>
236
+ <text>So cold...Starbucks north side, you win the day, but I shall bring a sweatshirt to our next battle!</text>
237
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
238
+ <truncated>false</truncated>
239
+ <in_reply_to_status_id></in_reply_to_status_id>
240
+ <in_reply_to_user_id></in_reply_to_user_id>
241
+ <favorited></favorited>
242
+ <user>
243
+ <id>4243</id>
244
+ <name>John Nunemaker</name>
245
+ <screen_name>jnunemaker</screen_name>
246
+ <location>Mishawaka, IN, US</location>
247
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
248
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
249
+ <url>http://addictedtonew.com</url>
250
+ <protected>false</protected>
251
+ <followers_count>486</followers_count>
252
+ </user>
253
+ </status>
254
+ <status>
255
+ <created_at>Thu Aug 07 17:25:40 +0000 2008</created_at>
256
+ <id>880610064</id>
257
+ <text>Headed home for a bit to get my headphones and then to the north side to meet @orderedlist.</text>
258
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
259
+ <truncated>false</truncated>
260
+ <in_reply_to_status_id></in_reply_to_status_id>
261
+ <in_reply_to_user_id></in_reply_to_user_id>
262
+ <favorited></favorited>
263
+ <user>
264
+ <id>4243</id>
265
+ <name>John Nunemaker</name>
266
+ <screen_name>jnunemaker</screen_name>
267
+ <location>Mishawaka, IN, US</location>
268
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
269
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
270
+ <url>http://addictedtonew.com</url>
271
+ <protected>false</protected>
272
+ <followers_count>485</followers_count>
273
+ </user>
274
+ </status>
275
+ <status>
276
+ <created_at>Thu Aug 07 17:15:59 +0000 2008</created_at>
277
+ <id>880600278</id>
278
+ <text>Panera wifi, why do you hate me?</text>
279
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
280
+ <truncated>false</truncated>
281
+ <in_reply_to_status_id></in_reply_to_status_id>
282
+ <in_reply_to_user_id></in_reply_to_user_id>
283
+ <favorited></favorited>
284
+ <user>
285
+ <id>4243</id>
286
+ <name>John Nunemaker</name>
287
+ <screen_name>jnunemaker</screen_name>
288
+ <location>Mishawaka, IN, US</location>
289
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
290
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
291
+ <url>http://addictedtonew.com</url>
292
+ <protected>false</protected>
293
+ <followers_count>485</followers_count>
294
+ </user>
295
+ </status>
296
+ <status>
297
+ <created_at>Thu Aug 07 15:46:25 +0000 2008</created_at>
298
+ <id>880509577</id>
299
+ <text>At panera. Turned my alarm off this morning and woke up late. Oh well.</text>
300
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
301
+ <truncated>false</truncated>
302
+ <in_reply_to_status_id></in_reply_to_status_id>
303
+ <in_reply_to_user_id></in_reply_to_user_id>
304
+ <favorited></favorited>
305
+ <user>
306
+ <id>4243</id>
307
+ <name>John Nunemaker</name>
308
+ <screen_name>jnunemaker</screen_name>
309
+ <location>Mishawaka, IN, US</location>
310
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
311
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
312
+ <url>http://addictedtonew.com</url>
313
+ <protected>false</protected>
314
+ <followers_count>485</followers_count>
315
+ </user>
316
+ </status>
317
+ <status>
318
+ <created_at>Thu Aug 07 15:01:35 +0000 2008</created_at>
319
+ <id>880463746</id>
320
+ <text>@kloh I remember days like that. Exhausting. Also, NullRiver said to sync again, uninstall app from phone and then resync app. Evidently ...</text>
321
+ <source>web</source>
322
+ <truncated>true</truncated>
323
+ <in_reply_to_status_id>880432701</in_reply_to_status_id>
324
+ <in_reply_to_user_id>10193732</in_reply_to_user_id>
325
+ <favorited></favorited>
326
+ <user>
327
+ <id>4243</id>
328
+ <name>John Nunemaker</name>
329
+ <screen_name>jnunemaker</screen_name>
330
+ <location>Mishawaka, IN, US</location>
331
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
332
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
333
+ <url>http://addictedtonew.com</url>
334
+ <protected>false</protected>
335
+ <followers_count>485</followers_count>
336
+ </user>
337
+ </status>
338
+ <status>
339
+ <created_at>Thu Aug 07 02:52:38 +0000 2008</created_at>
340
+ <id>879986739</id>
341
+ <text>@kloh - I haven't updated my OS so I'm wondering how apple could have made the app stop working. I did contact NullRiver support just no ...</text>
342
+ <source>web</source>
343
+ <truncated>true</truncated>
344
+ <in_reply_to_status_id>879980813</in_reply_to_status_id>
345
+ <in_reply_to_user_id>10193732</in_reply_to_user_id>
346
+ <favorited></favorited>
347
+ <user>
348
+ <id>4243</id>
349
+ <name>John Nunemaker</name>
350
+ <screen_name>jnunemaker</screen_name>
351
+ <location>Mishawaka, IN, US</location>
352
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
353
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
354
+ <url>http://addictedtonew.com</url>
355
+ <protected>false</protected>
356
+ <followers_count>486</followers_count>
357
+ </user>
358
+ </status>
359
+ <status>
360
+ <created_at>Thu Aug 07 02:38:58 +0000 2008</created_at>
361
+ <id>879976045</id>
362
+ <text>@jerry - i went with the pdf download.</text>
363
+ <source>web</source>
364
+ <truncated>false</truncated>
365
+ <in_reply_to_status_id>879878196</in_reply_to_status_id>
366
+ <in_reply_to_user_id>613</in_reply_to_user_id>
367
+ <favorited></favorited>
368
+ <user>
369
+ <id>4243</id>
370
+ <name>John Nunemaker</name>
371
+ <screen_name>jnunemaker</screen_name>
372
+ <location>Mishawaka, IN, US</location>
373
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
374
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
375
+ <url>http://addictedtonew.com</url>
376
+ <protected>false</protected>
377
+ <followers_count>486</followers_count>
378
+ </user>
379
+ </status>
380
+ <status>
381
+ <created_at>Thu Aug 07 02:31:26 +0000 2008</created_at>
382
+ <id>879969851</id>
383
+ <text>@kloh - it worked at home for multiple tests and just stopped when I acyltually needed it.</text>
384
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
385
+ <truncated>false</truncated>
386
+ <in_reply_to_status_id>879968483</in_reply_to_status_id>
387
+ <in_reply_to_user_id>10193732</in_reply_to_user_id>
388
+ <favorited></favorited>
389
+ <user>
390
+ <id>4243</id>
391
+ <name>John Nunemaker</name>
392
+ <screen_name>jnunemaker</screen_name>
393
+ <location>Mishawaka, IN, US</location>
394
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
395
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
396
+ <url>http://addictedtonew.com</url>
397
+ <protected>false</protected>
398
+ <followers_count>486</followers_count>
399
+ </user>
400
+ </status>
401
+ <status>
402
+ <created_at>Thu Aug 07 01:18:28 +0000 2008</created_at>
403
+ <id>879913748</id>
404
+ <text>Netshare will no longer start up for me. Of course it borks the first time I actually want to use it.</text>
405
+ <source>&lt;a href="http://help.twitter.com/index.php?pg=kb.page&amp;id=75"&gt;txt&lt;/a&gt;</source>
406
+ <truncated>false</truncated>
407
+ <in_reply_to_status_id></in_reply_to_status_id>
408
+ <in_reply_to_user_id></in_reply_to_user_id>
409
+ <favorited></favorited>
410
+ <user>
411
+ <id>4243</id>
412
+ <name>John Nunemaker</name>
413
+ <screen_name>jnunemaker</screen_name>
414
+ <location>Mishawaka, IN, US</location>
415
+ <description>Loves his wife, ruby, notre dame football and iu basketball</description>
416
+ <profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/53781608/Photo_75_normal.jpg</profile_image_url>
417
+ <url>http://addictedtonew.com</url>
418
+ <protected>false</protected>
419
+ <followers_count>486</followers_count>
420
+ </user>
421
+ </status>
422
+ </statuses>
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe HappyMapper::Attribute do
4
+ describe "initialization" do
5
+ before do
6
+ @attr = HappyMapper::Attribute.new(:foo, String)
7
+ end
8
+
9
+ it 'should know that it is an attribute' do
10
+ @attr.attribute?.should be_true
11
+ end
12
+
13
+ it 'should know that it is NOT an element' do
14
+ @attr.element?.should be_false
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe HappyMapper::Element do
4
+ describe "initialization" do
5
+ before do
6
+ @attr = HappyMapper::Element.new(:foo, String)
7
+ end
8
+
9
+ it 'should know that it is an element' do
10
+ @attr.element?.should be_true
11
+ end
12
+
13
+ it 'should know that it is NOT an attribute' do
14
+ @attr.attribute?.should be_false
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,94 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe HappyMapper::Item do
4
+
5
+ describe "new instance" do
6
+ before do
7
+ @item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
8
+ end
9
+
10
+ it "should accept a name" do
11
+ @item.name.should == 'foo'
12
+ end
13
+
14
+ it 'should accept a type' do
15
+ @item.type.should == String
16
+ end
17
+
18
+ it 'should accept :tag as an option' do
19
+ @item.tag.should == 'foobar'
20
+ end
21
+
22
+ it "should have a method_name" do
23
+ @item.method_name.should == 'foo'
24
+ end
25
+ end
26
+
27
+ describe "#method_name" do
28
+ it "should convert dashes to underscores" do
29
+ item = HappyMapper::Item.new(:'foo-bar', String, :tag => 'foobar')
30
+ item.method_name.should == 'foo_bar'
31
+ end
32
+ end
33
+
34
+ describe "#xpath" do
35
+ it "should default to tag" do
36
+ item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
37
+ item.xpath.should == 'foobar'
38
+ end
39
+
40
+ it "should prepend with .// if options[:deep] true" do
41
+ item = HappyMapper::Item.new(:foo, String, :tag => 'foobar', :deep => true)
42
+ item.xpath.should == './/foobar'
43
+ end
44
+
45
+ it "should prepend namespace if namespace exists" do
46
+ item = HappyMapper::Item.new(:foo, String, :tag => 'foobar')
47
+ item.namespace = 'v2'
48
+ item.xpath.should == 'v2:foobar'
49
+ end
50
+ end
51
+
52
+ describe "typecasting" do
53
+ it "should work with Strings" do
54
+ item = HappyMapper::Item.new(:foo, String)
55
+ [21, '21'].each do |a|
56
+ item.typecast(a).should == '21'
57
+ end
58
+ end
59
+
60
+ it "should work with Integers" do
61
+ item = HappyMapper::Item.new(:foo, Integer)
62
+ [21, 21.0, '21'].each do |a|
63
+ item.typecast(a).should == 21
64
+ end
65
+ end
66
+
67
+ it "should work with Floats" do
68
+ item = HappyMapper::Item.new(:foo, Float)
69
+ [21, 21.0, '21'].each do |a|
70
+ item.typecast(a).should == 21.0
71
+ end
72
+ end
73
+
74
+ it "should work with Times" do
75
+ item = HappyMapper::Item.new(:foo, Time)
76
+ item.typecast('2000-01-01 01:01:01.123456').should == Time.local(2000, 1, 1, 1, 1, 1, 123456)
77
+ end
78
+
79
+ it "should work with Dates" do
80
+ item = HappyMapper::Item.new(:foo, Date)
81
+ item.typecast('2000-01-01').should == Date.new(2000, 1, 1)
82
+ end
83
+
84
+ it "should work with DateTimes" do
85
+ item = HappyMapper::Item.new(:foo, DateTime)
86
+ item.typecast('2000-01-01 00:00:00').should == DateTime.new(2000, 1, 1, 0, 0, 0)
87
+ end
88
+
89
+ it "should work with Boolean" do
90
+ item = HappyMapper::Item.new(:foo, Boolean)
91
+ item.typecast('false').should == false
92
+ end
93
+ end
94
+ end