Skip to content

Commit

Permalink
Require activesupport/all to more closely mirror a production Rails app.
Browse files Browse the repository at this point in the history
ActiveSupport patches Kernel to add `class_eval` but this behavior wasn't
loaded in the test environment. This created a discrepancy between test
and prod, causing tests to fail that should have passed and vice versa.
Fully loading ActiveSupport makes the test environment more accurate.
  • Loading branch information
sinisterchipmunk authored and picandocodigo committed Sep 5, 2024
1 parent 77d39e8 commit 7e8fc93
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elasticsearch-model/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
require 'yaml'
require 'active_record'

# Load all of ActiveSupport to be sure of complete compatibility -
# see https://github.com/elastic/elasticsearch-rails/pull/1075 for details
require 'active_support/all'

unless defined?(ELASTICSEARCH_URL)
ELASTICSEARCH_URL = ENV['ELASTICSEARCH_URL'] || "localhost:#{(ENV['TEST_CLUSTER_PORT'] || 9200)}"
end
Expand Down

0 comments on commit 7e8fc93

Please sign in to comment.