[rspec-users] Clear a stub
vertebrate at gmail.com
Sun Jul 27 15:13:48 EDT 2008
Pat Maddox 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?
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
describe "with reservations" do
fixtures :customers, :users, :products, :reservation_statuses,
res = [reservations(:single), reservations(:cancelled),
it "should group the reservations by date for the view assign" do
rd = assigns[:reservation_dates]
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.
More information about the rspec-users