# Reloading a model in test mode

**URL:** <https://www.ruby-forum.com/t/reloading-a-model-in-test-mode/209724>\
**Category:** Rails\
**Created:** [July 21, 2011, 8:56am UTC](https://www.ruby-forum.com/t/reloading-a-model-in-test-mode/209724 "2011-07-21T08:56:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 21, 2011, 8:56am UTC](https://www.ruby-forum.com/t/reloading-a-model-in-test-mode/209724/1 "2011-07-21T08:56:33Z")

</div>

I have a model which configures some if its associations dynamically  
from configuration.

Here’s a simplified snippet:  
class Article  
(…)  
FacetConfig.facets.each do | f |  
has\_many f.name, :class\_name =\> ‘PropertyFacet’, :conditions =\>  
{:facet =\> f.name}  
end  
end

In my integration tests I’d like to set up certain FacetConfig  
configurations and run test specific to these configurations. However,  
changing the config also requires reloading the Article class.

How can I reload a model in test mode? I assume it has to be possible  
somehow, as that’s what happens in development mode by default.

Thanks in advance!  
Simon
