[LRUG] Missing tests in Rails upgrade

Jonathon Horsman jonno at spleatapp.com
Wed Jun 25 09:42:32 PDT 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140625/223aed4e/attachment-0003.html>


More information about the Chat mailing list