diff --git a/lib/dotenv/rails.rb b/lib/dotenv/rails.rb index c799ffb4..38d71c57 100644 --- a/lib/dotenv/rails.rb +++ b/lib/dotenv/rails.rb @@ -45,7 +45,7 @@ def load # # Same as `load`, but will override existing values in `ENV` def overload - Dotenv.overload(*dotenv_files) + Dotenv.overload(*dotenv_files.reverse) end # Internal: `Rails.root` is nil in Rails 4.1 before the application is diff --git a/spec/dotenv/rails_spec.rb b/spec/dotenv/rails_spec.rb index 110e2496..71122b75 100644 --- a/spec/dotenv/rails_spec.rb +++ b/spec/dotenv/rails_spec.rb @@ -113,8 +113,8 @@ def add(*items) ) end - it "overloads .env.test with .env" do - expect(ENV["DOTENV"]).to eql("true") + it "overloads .env with .env.test" do + expect(ENV["DOTENV"]).to eql("test") end context "when loading a file containing already set variables" do @@ -125,7 +125,7 @@ def add(*items) expect do subject - end.to(change { ENV["DOTENV"] }.from("predefined").to("true")) + end.to(change { ENV["DOTENV"] }.from("predefined").to("test")) end end end