diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/selector.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 5ce541e178..c63dd1ca8a 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -166,10 +166,8 @@ module ActionDispatch def assert_select(*args, &block) @selected ||= nil - parser = HTMLSelector.new(@selected, args, Proc.new do |_| - root = Loofah.fragment('') - root.add_child @selected - root + parser = HTMLSelector.new(@selected, args, Proc.new do + Loofah.fragment('').tap { |fragment| fragment.add_child @selected } end) # Start with optional element followed by mandatory selector. |