Abort when `TestEnv.init` is not called in the `test` environment

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-09-14 17:23:10 +02:00
parent 3e5477b3ab
commit 827783054f
No known key found for this signature in database
GPG Key ID: 46DF07E5CD9E96AB
1 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,11 @@ module TestEnv
# See gitlab.yml.example test section for paths
#
def init(opts = {})
unless Rails.env.test?
puts "\nTestEnv.init can only be run if `RAILS_ENV` is set to 'test' not '#{Rails.env}'!\n"
exit 1
end
# Disable mailer for spinach tests
disable_mailer if opts[:mailer] == false