Write test
truongnmt opened this issue · comments
At the moment, the test suite for gem is not really careful written. All I see is only test test_that_it_has_a_version_number
.
https://github.com/ankane/authtrail/blob/master/test/authtrail_test.rb
I know it's bored and nothing interesting but I'm really interested on how we could write test. Because our gem depend on call warden callback Warden::Manager.after_set_user
and Warden::Manager.before_failure
. How we can trigger those on test mode 🤔
Hey @truongnmt, I typically use the combustion
gem to test gems that depend on Rails. I added the basic framework for it in 7e8903c.
Oh so instead of calling Devise sign_in
TestHelper, you use an DIY authenticate Warden::Strategies.add(:password, PasswordStrategy)
that trigger Warden callback.
Got it now! Thanks for fast response!