errbit/errbit — pull request #616 by durrantm (2013-11-30 21:00:44+00:00)
Title: Update rspec to use expect consistently and to use eq over == and {} over lambda

Hi, I'd like to offer this suggestion for changes to the RSpec syntax to use expect consistently throughout the test suite.

I noticed that the rspec 'expect' was now being used in specs such as

spec/interactors/problem_updater_cache_spec.rb
spec/controllers/notices_controller_spec.rb
spec/helpers/problems_helper_spec.rb
spec/models/problem_spec.rb
spec/models/error_report_spec.rb
spec/views/users/new.html.haml_spec.rb

along with many others in over 100 places. However both these and other specs were also still using the older .should syntax in other places, so this change would make the expect syntax usage consistent throughout the test suite. More than just a style change, it has turned turned out that using 'expect' over 'should' is a recommended practice because of dealing with delegate/proxy objects as detailed in http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax.
As detailed in the blog post "In the future, we plan to change the defaults so that only expect is available unless you explicitly enable should. We may do this as soon as RSpec 3.0, but we want to give users plenty of time to get acquianted with it." I've also noticed that many of the major github gems have already made the move. It also helps the spec and the error reporting readability be more english-like and in line with this I also changed the '==' operator to 'eq' as recommended in the post.
The only test that required an 'real' change to its test code itself was in spec/controllers/users_controller_spec.rb:24 whereby the change showed UTC not being equal to GMT:00:00:00 UTC. As both had "UTC", just in different formats, I changed the matcher to be "match". This seemed to preserve the integrity of the test itself.
All tests pass