2009-08-12 2 views
5

 이 내 레이아웃에 추가되었을 때 최근에 실패하기 시작한 오이 단계가 있습니다.  을 꺼내면 테스트가 모두 끝납니다. 내가 다시 넣어 때, WebRat에서 제공하는 click_link 방법을 사용하는 모든 테스트는 다음 메시지와 함께 실패합니다오이 및/또는 Webrat은  을 싫어합니까?

And he follows 'Unsubscribe' 
    incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) (Encoding::CompatibilityError) 
    (eval):3:in `click_link` 
    (eval):2:in `click_link` 
    /path_to_project/webrat_steps.rb:19:in `/^(I|he|she) follows? '([^\"]*)'$/' 
    features/manage_subscriptions.feature:59:in `And he follows 'Unsubscribe'' 

사람이 어떤 제안이 있습니까?

답변

5

나는 Ruby 1.9와 Rails 2.3.2에서 똑같은 문제를 겪었습니다. 작동시키기 위해서 나는 webrat gem에서 다음과 같이 변경해야했습니다. 그래서 위를해야했다

def replace_nbsp(str) 
    str.gsub([0xA0].pack('U'), ' ') 
end 

Ticket 260을 webrat하는 submited 패치도 있었다

def replace_nbsp(str) 
    if str.respond_to?(:valid_encoding?) 
    str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ') 
    else 
    str.gsub(/\xc2\xa0/u, ' ') 
    end 
end 

에,하지만 나를 위해 작동하지 않았다

lib/webrat/core/locators/link_locator.rb에서 나는 변경했다 . 희망이 도움이됩니다.