# Problems overriding Date#inspect in a file required in a test

**URL:** <https://www.ruby-forum.com/t/problems-overriding-date-inspect-in-a-file-required-in-a-test/134773>\
**Category:** Ruby\
**Created:** [April 14, 2008, 11:17pm UTC](https://www.ruby-forum.com/t/problems-overriding-date-inspect-in-a-file-required-in-a-test/134773 "2008-04-14T23:17:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/6bbea6/32.png) [@mman](https://www.ruby-forum.com/u/mman)\
**Post date:** [April 14, 2008, 11:17pm UTC](https://www.ruby-forum.com/t/problems-overriding-date-inspect-in-a-file-required-in-a-test/134773/1 "2008-04-14T23:17:55Z")

</div>

With reference to the previous thread  
[http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/0402853c3617e243#](http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/0402853c3617e243#)  
(“change usage of pp in Test::Unit assertions”), I’m finding something  
that I consider very odd.

Basically, I wanted to override Date#inspect in one place only, a  
small and nice common.rb file that I include anywhere else. For the  
same reasons, I wanted to say use\_pp=false there only.

This is the content of common.rb file:  
class Date  
def inspect  
to\_s  
end  
end

Test::Unit::Assertions.use\_pp = false

It seems that if I require this file in my test, nothing changes, Date  
instances are still printed using PP. The only way to make it work is  
through overriding inspect directly in the test file.

Is there something obvious about require and test/unit that I’m  
missing here?

Thanks  
MM
