From 5d3cb353701c84e80ce7f256757010dc2c6145b1 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 6 Nov 2008 13:52:52 -0500 Subject: [PATCH] Working on Webrat::Methods --- lib/webrat/core/methods.rb | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/webrat/core/methods.rb b/lib/webrat/core/methods.rb index c327be8..7f68824 100644 --- a/lib/webrat/core/methods.rb +++ b/lib/webrat/core/methods.rb @@ -11,31 +11,31 @@ module Webrat end end - def self.delegate_to_session_returning_response(*meths) - meths.each do |meth| - self.class_eval <<-RUBY - def #{meth}(*args, &blk) - webrat_session.#{meth}(*args, &blk) - return webrat_session.response - end - RUBY - end - end - def webrat_session @webrat_session ||= ::Webrat::Session.new end - delegate_to_session :within, :header, :http_accept, :basic_auth, - :save_and_open_page, :fill_in, :check, - :uncheck, :choose, :select, :attach_file, - :field_labeled, :cookies, :response, :current_page, - :current_url - - delegate_to_session_returning_response :visits, :click_link, :click_area, :click_button, :reload, :clicks_link_within - - alias reloads reload - alias visit visits + delegate_to_session \ + :visits, :visit, + :within, + :header, :http_accept, :basic_auth, + :save_and_open_page, + :fill_in, + :check, + :uncheck, + :choose, + :select, + :attach_file, + :cookies, + :response, + :current_page, + :current_url, + :click_link, + :click_area, + :click_button, + :reload, :reloads, + :clicks_link_within, + :field_labeled end end \ No newline at end of file