문제

나는 최근에 실패하기 시작한 오이 단계가 있습니다.   내 레이아웃에 추가되었습니다. 내가 가져 가면   내 테스트는 모두 통과합니다. 다시 넣으면 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''

누구든지 제안이 있습니까?

도움이 되었습니까?

해결책

나는 루비 1.9와 Rails 2.3.2에서도 같은 문제를 겪었습니다.

~ 안에 lib/webrat/core/locators/link_locator.rb 변경해야했습니다.

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

에게

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

Webrat에 제출 된 패치도있었습니다 티켓 260, 그러나 그것은 나를 위해 작동하지 않았으므로 위의 일을해야했습니다. 도움이 되었기를 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top