Skip to content

Commit

Permalink
Test that the model namespace isn't polluted.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sinisterchipmunk authored and picandocodigo committed Sep 5, 2024
1 parent 37388d6 commit 3a65d2c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
it 'imports all documents' do
expect(ImportArticle.search('*').results.total).to eq(10)
end

it "does not pollute the model's namespace" do
expect(ImportArticle.methods).not_to include(:__transform)
end
end

context 'when batch size is specified' do
Expand Down

0 comments on commit 3a65d2c

Please sign in to comment.