Pat M. wrote:
Can you paste your code please? Here’s an example I just whipped up
that seems to work fine…I’m using a stub defined inline, a stub
defined in two steps, and a partially stubbed object. They all shadow
the outer stub. What does your code look like?
Pat
It looks like I was lead somewhat astray. It wasn’t the stubbing, it’s
actually something wrong with the fixture loading. The other fixtures
that load with it seem to be okay, but the ones I need are just
returning empty arrays.
describe ReservationsController, “reservations/GET” do
describe “all reservations/ GET”, :shared => true do
…snip…
describe "with reservations" do
fixtures :customers, :users, :products, :reservation_statuses,
:reservations, :reservation_items
before(:each) do
res = [reservations(:single), reservations(:cancelled),
reservations(:surprise)]
Reservation.stub!(:find).and_return(res)
end
it "should group the reservations by date for the view assign" do
do_request
rd = assigns[:reservation_dates]
rd.should have(2).items
end
end
end
end
Instead of ‘res’ containing an array of three reservations, it’s just an
array of three empty arrays. I know the fixtures are good because I have
used them in other specs. The ‘reservations’ collection is present, and
it is aware of appropriate keys, but it just gives back empty arrays.
Any thoughts on my new and improved problem?
I should also note that I’m running off of svn r3312 from around mid
February. At this time I cannot update to trunk, so if it’s a problem,
and it has been fixed since that time, just let me know.