jrubyonrails - Question testing rails post -
using rails 3.0.3.
i have following route in routes.rb:
match "user/create_new_password/:reset_password_key" =>"users#create_new_password", :via=>[:get, :post], :as=>:create_new_password
when using route in view, form, works ok, i'm not able test it. i'm doing in functional test:
test "fail create password invalid key" post :create_new_password, {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user.reset_password_key"} end
and i'm getting error:
actioncontroller::routingerror: no route matches {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user.reset_password_key", :controller=>"users", :action=>"create_new_password"}
what's wrong here?
so, problem in parameter value
:reset_password_key
test "fail create password invalid key" post :create_new_password, {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user.reset_password_key"} end
it seems it's wrong . (dot) in parameter value.
if change other value without "." (dot), fine. following works expected:
test "fail create password invalid key" post :create_new_password, {:create_new_password=>{:password=>"1", :password_confirmation=>"1"}, :reset_password_key=>"user_reset_password_key"} end
Comments
Post a Comment