From cccc8a34f8a9811d2a6aba88cdcdc6f0fdb64529 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 27 Jul 2008 12:48:13 -0400 Subject: [PATCH] Moving within to Session --- lib/webrat/core/page.rb | 6 +----- lib/webrat/core/session.rb | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/webrat/core/page.rb b/lib/webrat/core/page.rb index 25430be..fedc518 100644 --- a/lib/webrat/core/page.rb +++ b/lib/webrat/core/page.rb @@ -24,10 +24,6 @@ module Webrat session.current_page = self end - def within(selector) - yield Scope.new(self, session.response_body, selector) - end - # Reloads the last page requested. Note that this will resubmit forms # and their data. # @@ -44,7 +40,7 @@ module Webrat # Example: # clicks_link_within "#user_12", "Vote" def clicks_link_within(selector, link_text) - within(selector) do |scope| + session.within(selector) do |scope| scope.clicks_link(link_text) end end diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index e2b274f..e63259f 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -50,6 +50,10 @@ module Webrat @current_page = new_page end + def within(selector) + yield Scope.new(current_page, response_body, selector) + end + def visits(*args) Page.new(self, *args) end