Merge commit 'manveru/dev' into ruby19

Conflicts:
	lib/webrat/core/elements/field.rb
This commit is contained in:
Bryan Helmkamp 2009-06-14 23:31:42 -04:00
commit 45e19867d6
4 changed files with 12 additions and 5 deletions

View File

@ -134,8 +134,7 @@ module Webrat
end end
def escaped_value def escaped_value
value = @value.respond_to?(:join) ? @value.join : @value CGI.escape([*@value].first.to_s)
value ? CGI.escape(value) : ""
end end
def labels def labels

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,15 @@ module Webrat
end end
def replace_nbsp(str) 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 end
def replace_nbsp_ref(str) def replace_nbsp_ref(str)

View File

@ -67,7 +67,7 @@ module Webrat #:nodoc:
else else
current_path.split("/")[0..(-1 - levels_up)].join("/") current_path.split("/")[0..(-1 - levels_up)].join("/")
end end
descendent = url.split("/")[levels_up..-1] descendent = url.split("/")[levels_up..-1].join
"#{ancestor}/#{descendent}" "#{ancestor}/#{descendent}"
end end
end end