# Testing includes

**URL:** <https://www.ruby-forum.com/t/testing-includes/144529>\
**Category:** Rails\
**Created:** [July 30, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/testing-includes/144529 "2008-07-30T18:08:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [July 30, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/testing-includes/144529/1 "2008-07-30T18:08:29Z")

</div>

Should one be testing things like ‘include FooBar’ when testing a model?

- Where FooBar is an externally maintained and separately tested module.

Thanks,

~ Mark

---

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [July 30, 2008, 7:37pm UTC](https://www.ruby-forum.com/t/testing-includes/144529/2 "2008-07-30T19:37:10Z")

</div>

Hi Mark,

Mark D. wrote:

> Should one be testing things like ‘include FooBar’  
> when testing a model?
> 
> - Where FooBar is an externally maintained and  
> separately tested module.

My rule of thumb is to write tests that protect me from / let me  
refactor  
the layer ‘below’. So in this case, for example, I’d write unit tests  
for  
the things I was doing in my model that depend on the included module to  
‘protect’ me if 1) I decide to use a new library for that functionality,  
or  
2) there’s an update to that module and I want to make sure the changes  
to  
it haven’t adversely affected my app, or 3) the include statement in the  
model somehow gets deleted.

HTH,  
Bill

---

<div class="post-metadata">

**Author:** ![mdaoust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@mdaoust](https://www.ruby-forum.com/u/mdaoust)\
**Post date:** [July 30, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/testing-includes/144529/3 "2008-07-30T19:46:50Z")

</div>

Thanks Bill, that’s really helpful.

~ Mark
