[LRUG] Missing tests in Rails upgrade

George Drummond georgedrummond at gmail.com
Wed Jun 25 10:13:46 PDT 2014


You could have stored a users login (crypted password, salt, email) in a
fixture and then had a capybara test to make sure you can access their
account. A change in the encryption mechanism would have broken this spec.




On Wed, Jun 25, 2014 at 12:42 PM, Jonathon Horsman <jonno at spleatapp.com>
wrote:

> I've just upgraded our Rails app from 3.2.something to 4.1.1
>
> Having thought the test coverage was pretty good, a couple of bugs were
> found which were not picked up by Rspec post-upgrade.
>
> The authlogic gem is used for logging in, and its encryption mechanism
> changed, meaning effectively no one could log in. Details here:
> https://github.com/binarylogic/authlogic/issues/400
>
> I'm struggling to conceive a test which would capture this, short of
> setting the crypted_password field for a user directly in the database,
> which seems like very tight coupling.
>
> Secondly, a POST stopped working and needed to be replaced with PATCH,
> mentioned here:
> http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#http-patch
>
> Essentially my controller tests can call 'post' or 'get' or 'patch' on a
> method, and the named controller method will get invoked in the test.
> However in the real world, only an HTTP PATCH will work (or a POST with
> 'patch' set for the _method parameter).
> What test should pick this up? Do I need router tests for every controller
> test?
>
> Thanks
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140625/65b5d7a4/attachment.html>


More information about the Chat mailing list