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

M

mmalaidini

With reference to the previous thread
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top