Don't use $LAST_MATCH_INFO since we don't require English.rb, use $~ instead
This commit is contained in:
parent
48a4ec905e
commit
520081c93e
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue