Yes, mocking the database calls, sounds like the best option to
maintain the flow of the story.
I''m trying to mock it by using this:
Image.should_receive(:find).and_return(@image)
get :contoller_action_that_creates_the_worker
Now, when I''m inside the worker I use the ruby debugger to see
what''s
happening, but I can still see only the fixtures, and the rspec
mocking call seems to lose it''s context and not get used.
What would you suggest to mock the database call?
Thank you!
Rai
On Jan 3, 2008, at 11:01 PM, hemant wrote:
> On Jan 3, 2008 9:34 PM, Raimond Garcia <voodoorai2000 at gmail.com>
> wrote:
>> Hi,
>>
>> I would like to use backgroundrb inside a story, been trying to set
>> this up for a while, but I think the only solution is to use fixture
>> files and unit testing. The problem is that every time I call a new
>> worker, the test database gets wiped out, and only has available the
>> records in fixture files. Instead, it would be great if the test
>> database maintains its state throughout the rspec Story and so can
>> use
>> and update the records of previous steps.
>
> Or you can mock calls to database.
>
> --
> Let them talk of their oriental summer climes of everlasting
> conservatories; give me the privilege of making my own summer with my
> own coals.
>
> http://gnufied.org