Ignore all .lock files.
Support for multiple Rails versions, starting from 3.1.x
Change test engine definition, so it works in Rails 3.1

::use_relative_model_naming? was introduced in Rails 3.2, so this setup wasn't working for 3.1. Normal engine definition is compatible across all versions.
Match response body for both Rails 3 and 4.
Monkey patch FlashHash in test_helper to get used keys.

Return @used (Rails 3) or @discard (Rails 4) if available.