# Tests fail when overwriting models

**URL:** <https://www.ruby-forum.com/t/tests-fail-when-overwriting-models/114947>\
**Category:** Engines\
**Created:** [September 19, 2007, 2:51am UTC](https://www.ruby-forum.com/t/tests-fail-when-overwriting-models/114947 "2007-09-19T02:51:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Kroman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f9ae1b/32.png) [@Alex\_Kroman](https://www.ruby-forum.com/u/Alex_Kroman)\
**Post date:** [September 19, 2007, 2:51am UTC](https://www.ruby-forum.com/t/tests-fail-when-overwriting-models/114947/1 "2007-09-19T02:51:21Z")

</div>

Hi all,

I just converted one of our internal applications to use engines and am  
really impressed so far. I’m hoping you can help me clear up a bit of a  
problem I am having.

I set up a new application using the engine and everything works great.

The client requests that the user registration page collect the user’s  
birthday. I write a test, create a migration, overwrite the user model  
to validate\_presence\_of :birth\_date and everything works perfectly.

Unfortunately when I run rake:test:plugins I get a bunch of test  
failures because the model is looking for birth\_date. Is there a way to  
test your engine without loading up all of the things you are  
overwriting in the app directory?

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![Alex\_Kroman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f9ae1b/32.png) [@Alex\_Kroman](https://www.ruby-forum.com/u/Alex_Kroman)\
**Post date:** [September 24, 2007, 11:32am UTC](https://www.ruby-forum.com/t/tests-fail-when-overwriting-models/114947/2 "2007-09-24T11:32:43Z")

</div>

In general, you can set

Engines.disabled\_application\_code\_loading = true

to disable the code mixing features when you want to test your bare  
plugin controllers, etc. However, since the code mixing doesn’t work  
(at the moment) with models, this probably wont help.

The reason why your models are being loaded is simply because  
app/models is in the load path, so in your specific case, you might be  
able to get around it by removing that path from $LOAD\_PATH.

You could also add a Rakefile to your plugin which you can use to run  
the tests for your plugin without going through Rails - this would  
also isolate your code from anything in app.

HTH,

James
