From 8b98540aef3f3a6b353bc8c7fa655181c6947ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ku=C5=BAma?= Date: Tue, 26 May 2009 10:41:00 +0200 Subject: [PATCH] Ruby 1.9 compatibility: Avoid calling #to_s on Arrays [#249 state:resolved] --- History.txt | 17 +++++++++-------- lib/webrat/core/elements/field.rb | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/History.txt b/History.txt index 303cfa54..8c81f99e 100644 --- a/History.txt +++ b/History.txt @@ -24,15 +24,16 @@ * Bug fixes * Translate CSS and image paths with single quotes in save_and_open_page (Erin Staniland) + * Ruby 1.9 compatibility: Avoid calling #to_s on Arrays (Jakub Kuźma) == 0.4.4 / 2009-04-06 * Major enhancements * Make selenium process management code more robust and informative - + * Minor enhancements - + * Add support for Rails javascript post links (Mark Menard) * Upgrade selenium-client dependency to 1.2.14, and update for new waiting API (Balint Erdi) @@ -43,7 +44,7 @@ * Don't create a new instance of WWW::Mechanize for each request (Mark Menard) * Select fields with duplicate selected options sent an incorrect value (Noah Davis) - + == 0.4.3 / 2009-03-17 * Minor enhancements @@ -53,7 +54,7 @@ * Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe) * When faced with a label with no for attribute, that contains a hidden field and another field, as can be the case in Rails 2.3's checkbox view, - webrat now locates the non-hidden field. (Luke Melia) + webrat now locates the non-hidden field. (Luke Melia) * Add application_framework config for Selenium mode to determine how to start and stop the app server (Corey Donohoe) @@ -69,7 +70,7 @@ attributes in a hash and :count and :content options. See have_selector_spec.rb for more. * Add the same functionality mentioned above to have_xpath - + * Minor enhancements * Squeeze extra whitespace out of failures messages from contain @@ -96,7 +97,7 @@ redirected to (Adam Greene) * Recognize input tags with type button (Lena Herrmann) * Add uncheck method to Selenium mode (Lee Bankewitz) - + * Bug fixes * Make requests to a Rails app using a full URL instead of a relative path. This change @@ -107,7 +108,7 @@ to behave correctly (Noah Davis) * Switch to using selenium.click instead of .check when checking a checkbox (Noah Davis) - * Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney) + * Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney) * Setup deprecated writers for the selenium_environment= and selenium_port= config * Ensure the previous pages params aren't passed through redirect (Daniel Lucraft and Bryan Helmkamp) @@ -183,7 +184,7 @@ * Added save_and_open_screengrab for Selenium mode (Luke Melia) * Bug fixes - + * field_labeled should disregard labels without matching fields (Kyle Hargraves) * Fixed bug where Scope was creating a new DOM rather than re-using the existing DOM. [#105] (Zach Dennis) diff --git a/lib/webrat/core/elements/field.rb b/lib/webrat/core/elements/field.rb index c887167d..b81c38df 100644 --- a/lib/webrat/core/elements/field.rb +++ b/lib/webrat/core/elements/field.rb @@ -134,7 +134,8 @@ def name end def escaped_value - CGI.escape(@value.to_s) + value = @value.respond_to?(:join) ? @value.join : @value + value ? CGI.escape(value) : "" end def labels