Skip to content

Commit

Permalink
Remove instance after test
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Jan 20, 2024
1 parent 1350739 commit 870b883
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spec/dotenv/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

describe Dotenv::Rails do
before do
# Remove the singleton instance if it exists
Dotenv::Rails.remove_instance_variable(:@instance) rescue nil

Rails.env = "test"
allow(Rails).to receive(:root).and_return Pathname.new(__dir__).join("../fixtures")
Rails.application = double(:application)
Spring.watcher = Set.new # Responds to #add
end

after do
# Remove the singleton instance if it exists
Dotenv::Rails.remove_instance_variable(:@instance)
end

after do
# Reset
Spring.watcher = nil
Expand Down Expand Up @@ -53,8 +55,8 @@

context "before_configuration" do
it "calls #load" do
expect(Dotenv::Rails).to receive(:load)
ActiveSupport.run_load_hooks(:before_configuration, )
expect(Dotenv::Rails.instance).to receive(:load)
ActiveSupport.run_load_hooks(:before_configuration)
end
end

Expand Down

0 comments on commit 870b883

Please sign in to comment.