2009-08-12 7 views
5

 が私のレイアウトに追加されたときに最近失敗したキュウリのステップがあります。私が を出したら、私のテストはすべて合格になります。私は後ろにそれを置くときは、WebRatによって供給click_linkメソッドを使用するすべてのテストは、次のメッセージで失敗します。キュウリおよび/またはウィブラートは嫌いです ?

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では私が変更しなければなりませんでした。お役に立てれば。

関連する問題