Fix test_mode for ruby 1.9