Skip to content

Commit 03dd182

Browse files
sinisterchipmunkpicandocodigo
authored andcommitted
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 0b1863a commit 03dd182

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)