Working on Webrat::Methods
This commit is contained in:
parent
33e0000c5a
commit
5d3cb35370
@ -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
|
Loading…
Reference in New Issue
Block a user