Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/dotenv/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
#
# Dotenv loads environment variables when the Rails application is initialized.
# When running `rake`, the Rails application is initialized in development.
# Rails includes some hacks to set `RAILS_ENV=test` when running `rake test`,
# but rspec does not include the same hacks.
#
# See https://github.com/bkeepers/dotenv/issues/219
if defined?(Rake.application)
task_regular_expression = /^(default$|parallel:spec|spec(:|$))/
task_regular_expression = /^(default$|test(:|$)|parallel:spec|spec(:|$))/
if Rake.application.top_level_tasks.grep(task_regular_expression).any?
environment = Rake.application.options.show_tasks ? "development" : "test"
Rails.env = ENV["RAILS_ENV"] ||= environment
Expand Down