Forum: RSpec Are there any example specs for content importers to learn from

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5a2074a93a1a5d213926c7bb6d9d79e7?d=identicon&s=25 Chris Adams (Guest)
on 2009-03-21 19:29
(Received via mailing list)
Hi guys,

This is my first post to the mailing list, so apologies if this kind
of question comes up alot already.

I've been working through the Peepcode screencasts on RSpec, and I'm
trying to what I've been learning into practice to make an importer on
a rails app that takes an xml feed, and imports each entry in the xml
feed into the database, skipping imports if they already exist in the

The thing is, I don't know the best way to do this, as most examples
I've seen only refer to handing objects one at a time.

Could someone point me to a couple of code examples of what importer
specs should look like when written in rspec, or tell me roughly how I
should be approaching this ?

I've put the generic version of the code in this gist, to give an idea
of where I'm headed at the mo, but any feedback would be greatly

Thanks and have a good weekend,


I'm currently only checking my email at 9am, midday and at 4pm.
If you need a response from me urgently, please call or text my
mobile, or contact me via Skype (chris.d.adams).
Chris Adams
Stemcel Studios
The Hub
5 Torrens Street

skype: chris.d.adams
mob: 07974 368 229
tel: 0207 558 8971
39100495c9937c39b2e0c704444e1b4a?d=identicon&s=25 Pat Maddox (Guest)
on 2009-03-21 22:35
(Received via mailing list)
That's basically what I do. shows one I
wrote a couple days ago.  I yield each object because there are like
400k records and I can't keep them in memory.  Might be a little nicer
to yield the params hash and let the caller build the object, but I
don't need that flexibility at this point.

This topic is locked and can not be replied to.