> I've got a lot of rspec controller tests. At the beginning of each > controller, I have: > > def authenticate > ... > end > > def logout > ... > end > > Authenticates creates me a @current_user, logout destroys the @current_user. > As I said, this code is at the beginning of each controller, not very DRY :-) > > Any hints for me, where to put this code and how to integrate it in my tests, > to not always rewrite this two methods?
You could create a file in spec/support/current_user.rb (or whatever, doesn't matter as long as it's in spec/support/*.rb) and put them in there. Then they'll be available to all your specs... -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.