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