strange problem for nokogiri on Rails 3

I am test the script named test.rb by command "ruby test.rb" and it pass. Then i converte it as rake task. The rake task pass on rails 2.3.4 but fail on rails 3 beta4