Skip to content

Commit

Permalink
Merge pull request #2949 from zendesk/ashah/test
Browse files Browse the repository at this point in the history
load .env.test when running with bundle exec rails test file.rb inste…
  • Loading branch information
grosser authored Sep 22, 2018
2 parents 4327374 + e98b74b commit 3b856b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# frozen_string_literal: true
require 'bundler/setup'

raise "ENV clearing failed" if File.expand_path(ENV.fetch("BUNDLE_GEMFILE")) != File.expand_path("Gemfile")

ENV["RAILS_ENV"] = "test" if ARGV[0] == "test" # configure test env early for `bundle exec rails test some_test.rb`
require_relative 'dotenv'

rails_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
if ['development', 'test'].include?(rails_env)
require 'bootsnap'
Expand Down

0 comments on commit 3b856b3

Please sign in to comment.