开发者

Clearance with Test::Unit

I am using Clearance for authentication with 开发者_C百科my rails app which works. But now all my unit tests fail because they redirect to the sign in page, which makes sense. Clearance seems to have helper functions for fixing that but I can only find them for Shoulda. Are there equivalent helpers for Test::Unit?


I thought there'd be more 'magic' to how the shoulda macros work but it's actually really simple. To add the sign_in behavior just add this to the test_helper.rb

  def sign_in_as(user)
    @controller.current_user = user
    return user
  end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜