Fix controller tests and deprecation warnings in Rails 4