From afa4caf2bdd35e959674152d89b49968129e9fc9 Mon Sep 17 00:00:00 2001 From: Timm Date: Sat, 20 Jul 2013 14:09:21 +0200 Subject: Updated selector to not have reponse_from_page. --- actionpack/lib/action_dispatch/testing/assertions/selector.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_dispatch/testing/assertions/selector.rb') diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 883073ad3e..586a6bd1ff 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -61,7 +61,7 @@ module ActionDispatch def css_select(*args) raise ArgumentError, "you at least need a selector" if args.empty? - if args.first.is_a?(String) # allow nokogiri's ability to use several selectors + if args.first.is_a?(String) # allow nokogiri's ability to use more selectors root, selectors = response_from_page, args else root, selectors = args.shift, args @@ -160,8 +160,8 @@ module ActionDispatch def assert_select(*args, &block) @selected ||= nil - parser = HTMLSelector.new(@selected, args, Proc.new do - Loofah.fragment('').tap { |fragment| fragment.add_child @selected } + parser = HTMLSelector.new(@selected, reponse_from_page, args, Proc.new do + Loofah.fragment('').tap { |f| f.add_child @selected } end) # Start with optional element followed by mandatory selector. @@ -353,9 +353,10 @@ module ActionDispatch class Selector #:nodoc: attr_accessor :root, :css_selector - def initialize(selected, *args, &root_for_nested_call_proc) + def initialize(selected, page, *args, &root_for_nested_call_proc) raise ArgumentError, "ArgumentsParser expects a block for parsing a nested call's arguments" unless block_given? @nested_call = selected + @page = page @args = args @@ -381,7 +382,7 @@ module ActionDispatch # root_or_selector is a selector since the first call failed root_for_nested_select_proc.call(root_or_selector) else - response_from_page + @page end end -- cgit v1.2.3