aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-28 15:46:30 -0300
committerEmilio Tagua <miloops@gmail.com>2010-09-28 15:46:30 -0300
commit059d609a1a59300faefdc2d4186bae13b30c9699 (patch)
tree0a32722e1c2c85e5a7dd3b93762ca5d0c1078067 /actionpack/lib/action_dispatch/testing
parent97174980e5bf01e0ba80aed77a72ae4409a24be7 (diff)
downloadrails-059d609a1a59300faefdc2d4186bae13b30c9699.tar.gz
rails-059d609a1a59300faefdc2d4186bae13b30c9699.tar.bz2
rails-059d609a1a59300faefdc2d4186bae13b30c9699.zip
Avoid more uninitialized variable warnings.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/selector.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
index 9ae4f65db9..f5ecb9a199 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
@@ -187,6 +187,7 @@ module ActionDispatch
def assert_select(*args, &block)
# Start with optional element followed by mandatory selector.
arg = args.shift
+ @selected ||= nil
if arg.is_a?(HTML::Node)
# First argument is a node (tag or text, but also HTML root),
@@ -197,7 +198,7 @@ module ActionDispatch
# This usually happens when passing a node/element that
# happens to be nil.
raise ArgumentError, "First argument is either selector or element to select, but nil found. Perhaps you called assert_select with an element that does not exist?"
- elsif defined?(@selected) && @selected
+ elsif @selected
root = HTML::Node.new(nil)
root.children.concat @selected
else