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

Discussion in 'Ruby' started by mmalaidini@gmail.com, Apr 14, 2008.

  1. Guest

    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
    , Apr 14, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    595
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,244
    Michael Borgwardt
    May 30, 2004
  3. kj
    Replies:
    5
    Views:
    344
    Terry Reedy
    Aug 5, 2008
  4. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    690
    Skybuck Flying
    Oct 4, 2009
  5. deluxstar
    Replies:
    5
    Views:
    863
    Terry Reedy
    Sep 25, 2010
Loading...

Share This Page