[#60697304]write specifications
[#60697304]rename initializer to ensure it runs first
[#60697304] Downgrade Rails to 4.0.0

- update Devise to 3.1
- add Devise secret_key to environment