Hallo,

Schau dir mal die get methode an.
Get url, params_hash, session

Herzliche Grüße,
Michael


Am 16.05.2008 15:09 Uhr schrieb "Guido Pesch" unter
<[EMAIL PROTECTED]>:

> Hallo zusammen,
> 
> ich nutze in meiner Anwendung Restful Authentication.
> Um einen Functional Test auszuführen muss zunächst ein login durchgeführt
> werden. Habe diesen Artikel im Netz gefunden:
> http://alexbrie.net/1526/functional-tests-with-login-in-rails/.
> 
> mein test_helper sieht wie folgt aus:
> 
>   # Add more helper methods to be used by all tests here...
>   def login
>     puts '<<<<<<<< login >>>>>>>>'
>     old_controller = @controller
>     @controller = SessionsController.new
>     post :create, {:login => 'admin', :password => 'admin'}
>     assert_not_nil(session[:user_id])
>     @controller = old_controller
>   end
> 
> 
> Der Source im Testfall hat folgende gestallt:
> 
>   def test_should_get_index
>     login()
>     get :index
>     assert_response :success
>     assert_not_nil assigns(:dienstrang_people)
>   end
> 
> 
> In der Klasse User die über den Generator des Restful Authentication plugins
> generiert wurde gibt es folgende Methode:
> 
> # Authenticates a user by their login name and unencrypted password.  Returns
> the user or nil.
>   def self.authenticate(login, password)
>     puts '<<<<< authenticate >>>>>>>'
>     puts login
>     puts password
>     u = find_by_login(login) # need to get the salt
>     puts u.inspect
>     u && u.authenticated?(password) ? u : nil
>   end
> 
> Obwohl die Zeile
> u = find_by_login(login) # need to get the salt
> ausgeführt wird und das erzeugte SQL "SELECT * FROM `users` WHERE
> (`users`.`login` = 'admin') LIMIT 1"
> 
> korrekt ist, ist der Wert der Variablen u = nil
> 
> Hat da einer Idee warum das so ist.
> 
> Danke
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an