Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2939703

Browse files
sinisterchipmunkpicandocodigo
authored andcommittedSep 5, 2024·
Test that the model namespace isn't polluted.
The goal of ClassMethodsProxy is to avoid polluting the target's namespace, but it was possible to do this by accident when calling `class_eval` before ActiveSupport was completely loaded. This test ensures the namespace isn't polluted, regardless of the load state of ActiveSupport.
1 parent f104d3d commit 2939703

File tree

1 file changed

+4
-0
lines changed
  • elasticsearch-model/spec/elasticsearch/model/adapters/active_record

1 file changed

+4
-0
lines changed
 

‎elasticsearch-model/spec/elasticsearch/model/adapters/active_record/import_spec.rb

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
it 'imports all documents' do
5353
expect(ImportArticle.search('*').results.total).to eq(10)
5454
end
55+
56+
it "does not pollute the model's namespace" do
57+
expect(ImportArticle.methods).not_to include(:__transform)
58+
end
5559
end
5660

5761
context 'when batch size is specified' do

0 commit comments

Comments
 (0)
Please sign in to comment.