Skip to content

Commit

Permalink
Adding webrat.simulate and webrat.automate for using the same step ma…
Browse files Browse the repository at this point in the history
…thers in multiple modes
  • Loading branch information
brynary committed Dec 4, 2008
1 parent 881d9f3 commit 0e9f473
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/webrat/core/methods.rb
Expand Up @@ -11,6 +11,10 @@ def #{meth}(*args, &blk)
end
end

def webrat
webrat_session
end

def webrat_session
@_webrat_session ||= ::Webrat.session_class.new(self)
end
Expand Down Expand Up @@ -47,7 +51,9 @@ def webrat_session
:select_date, :select_time, :select_datetime,
:field_by_xpath,
:field_with_id,
:selenium
:selenium,
:simulate, :automate



end
Expand Down
10 changes: 10 additions & 0 deletions lib/webrat/core/session.rb
Expand Up @@ -208,6 +208,16 @@ def xml_content_type?
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
Expand Down

0 comments on commit 0e9f473

Please sign in to comment.