[Rails] Re: Functional Test Problem. Nubee, please help

Allen
Thu, 27 Apr 2006 21:33:58 -0000

Brian Hughes wrote:
> On Apr 27, 2006, at 04:44 PM, Allen wrote:
>>   def setup
>>     @controller = ActivitiesController.new
>>     @request    = ActionController::TestRequest.new
>>     @response   = ActionController::TestResponse.new
>>   end
>>
>> my "login" controller has a method "authenticate"
which needs
>> params[:username] and params[:password].  Please help!
>
> You can pass several hashes to all of the request methods: params,
> session and flash. From the AWDR chapter on Testing, specifically
> Testing Controllers:
>
>    get/post/put/delete/head(action, parameters=nil, session=nil,
> flash=nil)
>
>    Examples:
>    get :index
>    post :login, :user => {:name => "fred", :password =>
"abracadabra"}
>
> -Brian

But if i am in my ActivitiesController functional test, then a call to :

post :login, :user => {:name => "fred", :password =>
"abracadabra"}

will post to the login action of ActivitiesController and not
LoginController.  Do you see my problem?


--
Posted via http://www.ruby-forum.com/.