Casecommons / with_model

Dynamically build an Active Record model (with table) within a test context
http://www.casebook.net
MIT License
167 stars 18 forks source link

A mixed-in module's class_eval gets evaluated repeatedly on same class #5

Closed amarshall closed 13 years ago

amarshall commented 13 years ago

When the module mixed-in within the model block contains a class_eval that is run when the module is included, this class_eval was being run before each test on the same class, causing it to unexpectedly be re-evaluated, and causing unexpected behavior in things such as included ActiveRecord callbacks.

Tests passing under 1.8.7p352 & 1.9.2p290.