Skip to content

Commit 1ed9d58

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 8e6c03b commit 1ed9d58

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

Lines changed: 4 additions & 0 deletions
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)