Don't use $LAST_MATCH_INFO since we don't require English.rb, use $~ instead

This commit is contained in:
Michael Fellinger 2009-06-07 17:02:32 +09:00
parent 48a4ec905e
commit 520081c93e
2 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,7 @@ module Webrat
def authenticity_token def authenticity_token
return unless onclick && onclick.include?("s.setAttribute('name', 'authenticity_token');") && return unless onclick && onclick.include?("s.setAttribute('name', 'authenticity_token');") &&
onclick =~ /s\.setAttribute\('value', '([a-f0-9]{40})'\);/ onclick =~ /s\.setAttribute\('value', '([a-f0-9]{40})'\);/
$LAST_MATCH_INFO.captures.first $~.captures.first
end end
def onclick def onclick

View File

@ -45,7 +45,11 @@ module Webrat
end end
def replace_nbsp(str) def replace_nbsp(str)
str.gsub([0xA0].pack('U'), ' ') if str.respond_to?(:force_encoding)
str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ')
else
str.gsub("\xc2\xa0", ' ')
end
end end
def replace_nbsp_ref(str) def replace_nbsp_ref(str)