[rspec-users] Clear a stub

Pat Maddox pergesu at gmail.com
Mon Jul 28 08:39:23 EDT 2008

On Mon, Jul 28, 2008 at 12:08 AM, Steve <vertebrate at gmail.com> wrote:
> Pat Maddox wrote:
> ...big snip...
>> Well, a lot of stuff has happened since then :)  However, I'm not sure
>> what your problem is still so I can't tell you that it's been fixed
>> since then.  It sounds to me like you're saying reservations(:single)
>> returns a Reservation object in one test, but [] in this one.  Is that
>> accurate?
>> Pat
> Yes, that's exactly the case. Just empty arrays in this instance, but
> appropriate Reservation objects in other places. The other thing that gets
> me is that even the other fixtures at this time are correct. Like the
> customers, and users are both fine. It's just the reservations. I've also
> tried moving the fixtures loading up higher in the describe nesting,
> thinking that maybe it had something to do with being used in a 'shared'
> describe. That had no effect though. Am I tripping over some keyword magic
> maybe? I have no idea what magic that might be, I'm just thinking out loud.

Not sure.  Your best bet is probably to build it up piece by piece again.

describe "with reservations" do
  fixtures ....

  before(:each) do
    puts reservations(:single)

etc.  It's super weird that it works in every other place but not
here.  So I'd start from the tiniest thing possible and add lines
until you find one that breaks it.


More information about the rspec-users mailing list