From: OnRails Ruby Date: 2007-09-10T05:56:40+09:00 Subject: Re: how to fix assigns(:user) on controller test James Hunt wrote: > On 9/8/07, OnRails Ruby claimed: >> >> when I run this test, There always said, >> NoMetodError: You have a ni object when you didn't expect it: >> the error occurred while evaluating nil.password. >> >> I have try to use: >> assert_equal 'newpassword', assigns('user').password >> assert_equal 'newpassword', assigns[:user].password >> assert_equal 'newpassword', assigns['user'].password >> > > Are you using fixtures for your tests? (I assume you are, from the > assigns() usage). > > Can you post the fixtures? > >> Thanks! > You're welcome the fixtures file is: user1: id: 1 login: testuser1 user_name:asb password: 123 created_at: 2006-04-12 14:30:25 user2: id: 2 login: testuser2 user_name:asb123 password: 123 created_at: 2006-04-12 14:30:25 -- Posted via http://www.ruby-forum.com/.