aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-07-20 14:13:22 +0200
committerTimm <kaspth@gmail.com>2014-06-15 23:40:58 +0200
commit744cba7b21ba7fc8717c8aeb50a139c0e5238af3 (patch)
treeac13b36dc6f875aa49d777c5f83f1f1d9c0467d1 /actionpack
parentafa4caf2bdd35e959674152d89b49968129e9fc9 (diff)
downloadrails-744cba7b21ba7fc8717c8aeb50a139c0e5238af3.tar.gz
rails-744cba7b21ba7fc8717c8aeb50a139c0e5238af3.tar.bz2
rails-744cba7b21ba7fc8717c8aeb50a139c0e5238af3.zip
Removed the custom selected proc. It's no longer needed.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/selector.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
index 586a6bd1ff..7092b17042 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
@@ -160,9 +160,7 @@ module ActionDispatch
def assert_select(*args, &block)
@selected ||= nil
- parser = HTMLSelector.new(@selected, reponse_from_page, args, Proc.new do
- Loofah.fragment('').tap { |f| f.add_child @selected }
- end)
+ parser = HTMLSelector.new(@selected, reponse_from_page, args)
# Start with optional element followed by mandatory selector.
root = parser.root
@@ -353,9 +351,9 @@ module ActionDispatch
class Selector #:nodoc:
attr_accessor :root, :css_selector
- def initialize(selected, page, *args, &root_for_nested_call_proc)
+ def initialize(selected, page, *args)
raise ArgumentError, "ArgumentsParser expects a block for parsing a nested call's arguments" unless block_given?
- @nested_call = selected
+ @selected = selected
@page = page
@args = args
@@ -369,18 +367,18 @@ module ActionDispatch
end
def determine_root_from(root_or_selector)
- if root_or_selector.is_a?(Nokogiri::XML::Node)
+ if root_or_selector == 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 root_or_selector.is_a?(Nokogiri::XML::Node)
# First argument is a node (tag or text, but also HTML root),
# so we know what we're selecting from,
# we also know that the second argument is the selector
@css_selector_is_second_argument = true
root_or_selector
- elsif root_or_selector == 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 @nested_call
+ elsif @selected
# root_or_selector is a selector since the first call failed
- root_for_nested_select_proc.call(root_or_selector)
+ Loofah.fragment('').tap { |f| f.add_child @selected }
else
@page
end