That's basically what I do. http://gist.github.com/82981 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.
Pat On Sat, Mar 21, 2009 at 11:06 AM, Chris Adams <ch...@stemcel.co.uk> wrote: > 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 db. > > 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 appreciated. > > https://gist.github.com/38859f947860d4fc45e2 > > Thanks and have a good weekend, > > Chris > > -- > --- > 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 > London > EC1V 1NQ > > email: ch...@stemcel.co.uk > web: www.stemcel.co.uk > twitter:chris_d_adams > skype: chris.d.adams > mob: 07974 368 229 > tel: 0207 558 8971 > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users