small medium large xlarge

11 Jul 2010, 19:48
Alan Hecht (3 posts)

While reading the explanation for the ‘creation of status report with data’ test in Sec. 3.1, “First Test First”, it mentions that “Line 9 uses the Rails test framework assigns() method, which allows access to instance variables set in the controller being tested”. From what I can tell from spelunking the Rails code, the assigns() method only appears in the ActionController::Caching::Sweeper class for both Rails 2.3.x and Rails 3. Am I missing something?

I’m enjoying the book so far. It was very timely for me as I’m currently trying to get over the “hump” of not writing tests.

12 Jul 2010, 02:01
Noel Rappin (48 posts)

Alan, I believe that the @assigns@ method is defined in @ActionController::TestProcess@. Does that help?

Glad you are enjoying the book – tell all your friends!

12 Jul 2010, 02:59
Alan Hecht (3 posts)

Yep, it does. I didn’t see that before.

I’ve already been recommending the book, so hopefully at least a few will purchase it.