Adding webrat.simulate and webrat.automate for using the same step mathers in multiple modes

This commit is contained in:
Bryan Helmkamp 2008-12-03 22:23:13 -05:00
parent 881d9f388d
commit 0e9f4731bb
2 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,10 @@ module Webrat
end
end
def webrat
webrat_session
end
def webrat_session
@_webrat_session ||= ::Webrat.session_class.new(self)
end
@ -47,7 +51,9 @@ module Webrat
:select_date, :select_time, :select_datetime,
:field_by_xpath,
:field_with_id,
:selenium
:selenium,
:simulate, :automate
end

View File

@ -208,6 +208,16 @@ module Webrat
false
end
def simulate
return if Webrat.configuration.mode == :selenium
yield
end
def automate
return unless Webrat.configuration.mode == :selenium
yield
end
def_delegators :current_scope, :fill_in, :fills_in
def_delegators :current_scope, :set_hidden_field
def_delegators :current_scope, :submit_form