Merge commit 'manveru/dev' into ruby19
Conflicts: lib/webrat/core/elements/field.rb
This commit is contained in:
commit
45e19867d6
@ -134,8 +134,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def escaped_value
|
||||
value = @value.respond_to?(:join) ? @value.join : @value
|
||||
value ? CGI.escape(value) : ""
|
||||
CGI.escape([*@value].first.to_s)
|
||||
end
|
||||
|
||||
def labels
|
||||
|
@ -53,7 +53,7 @@ module Webrat
|
||||
def authenticity_token
|
||||
return unless onclick && onclick.include?("s.setAttribute('name', 'authenticity_token');") &&
|
||||
onclick =~ /s\.setAttribute\('value', '([a-f0-9]{40})'\);/
|
||||
$LAST_MATCH_INFO.captures.first
|
||||
$~.captures.first
|
||||
end
|
||||
|
||||
def onclick
|
||||
|
@ -45,7 +45,15 @@ module Webrat
|
||||
end
|
||||
|
||||
def replace_nbsp(str)
|
||||
str.gsub([0xA0].pack('U'), ' ')
|
||||
if str.respond_to?(:valid_encoding?)
|
||||
if str.valid_encoding?
|
||||
str.gsub(/\xc2\xa0/u, ' ')
|
||||
else
|
||||
str.force_encoding('UTF-8').gsub(/\xc2\xa0/u, ' ')
|
||||
end
|
||||
else
|
||||
str.gsub(/\xc2\xa0/u, ' ')
|
||||
end
|
||||
end
|
||||
|
||||
def replace_nbsp_ref(str)
|
||||
|
@ -67,7 +67,7 @@ module Webrat #:nodoc:
|
||||
else
|
||||
current_path.split("/")[0..(-1 - levels_up)].join("/")
|
||||
end
|
||||
descendent = url.split("/")[levels_up..-1]
|
||||
descendent = url.split("/")[levels_up..-1].join
|
||||
"#{ancestor}/#{descendent}"
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user