Assert_equal - problems returning value from controller

Hi,

I have the following assert_equal that is returning false.
@q seems to be returning niil, but is set in the controller, how can I
get hold of this value in my tests?

assert_equal ‘derby’, @q

Thanks
Mark

On Fri, Jul 06, 2007 at 11:00:51AM +0200, Mark wrote:

Hi,

I have the following assert_equal that is returning false.
@q seems to be returning niil, but is set in the controller, how can I
get hold of this value in my tests?

assert_equal ‘derby’, @q

assert_equal ‘derby’, assigns(:q)

Jens


Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/ - The new free film database

Mark wrote:

I have the following assert_equal that is returning false.
@q seems to be returning niil, but is set in the controller, how can I
get hold of this value in my tests?

assert_equal ‘derby’, @q

assert_equal ‘derby’, assigns[‘q’]

The deal is simply that ‘self’ in your tests is a different object than
the
‘self’ in your controllers. ‘self’ is the thing @ bonds to.

The test system knows this, so it passes all @ variables back to the
tests
in a hash called ‘assigns’.

Question for the crew - does this hash use .with_indifferent_access? If
not,
why not?


Phlip
Test Driven Ajax (on Rails) [Book]
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax

thanks