On 10 Dec 2008, at 16:26, James Byrne wrote:

James Byrne wrote:
Of course, the last example should have been:

When /user is authenticated/ do
 # We use Authlogic for authentication so just test that gem is loaded
 assert defined?("Authlogic")
end

To verify that the user has been authenticated, why not try something like

Then /I should see that I am logged in/ do
  user = User.first
  response.should include_text "welcome, #{user.username}"
end

This is much less coupled to your implementation, though it does assume that the 'I' referred to in the step is the only User in your database, or at least happens to be the first one. I'll leave it as a exercise to the reader to work around that one.

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to