[rspec-users] Specing a rails monkey patch
Mikel Lindsaar
raasdnil at gmail.com
Sat Jul 19 09:44:26 EDT 2008
On Fri, Jul 18, 2008 at 8:11 PM, Keith McDonnell <keith at dancingtext.com> wrote:
> I wrote an ActiveRecord extension to emulate a db cursor:
> http://pastie.org/236367
> As you can see, the spec doesn't really ensure that the records are fetched
> in chunks. I'd like to mock the call to AR find and ensure that it's called
> with an incrementing offset.
I'm using cursors to walk a table with close to a million rows at times.
I am just wrapping the action in a transaction and then declaring the
cursor within the transaction and then walking the table with a
find_by_sql with an SQL fetch command.
It works well.
Any reason you aren't doing it this way? Could just call it with a block...
Mikel
--
http://lindsaar.net/
Rails, RSpec and Life blog....
More information about the rspec-users
mailing list