Sha256: 4760e01d85b8aed6ea8b9a70ce8942ed5f2aa7f4d99c0c78820d9eb61642e2c4

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

module Webrat
  module Methods #:nodoc:

    def self.delegate_to_session(*meths)
      meths.each do |meth|
        self.class_eval <<-RUBY
          def #{meth}(*args, &blk)
            webrat_session.#{meth}(*args, &blk)
          end
          
          def webrat_session
            @_webrat_session ||= ::Webrat.session_class.new(self)
          end
        RUBY
      end
    end
    
    # all of these methods delegate to the @session, which should
    # be created transparently.
    #
    # Note that when using Webrat, #request also uses @session, so
    # that #request and webrat native functions behave interchangably

    delegate_to_session \
      :visits, :visit,
      :within,
      :header, :http_accept, :basic_auth,
      :save_and_open_page,
      :fills_in, :fill_in,
      :checks, :check, 
      :unchecks, :uncheck,
      :chooses, :choose,
      :selects, :select,
      :attaches_file, :attach_file,
      :current_page,
      :current_url,
      :clicks_link, :click_link,
      :clicks_area, :click_area,
      :clicks_button, :click_button,
      :reload, :reloads,
      :clicks_link_within, :click_link_within,
      :field_labeled,
      :select_option,
      :set_hidden_field, :submit_form,
      :request_page, :current_dom,
      :selects_date, :selects_time, :selects_datetime,
      :select_date, :select_time, :select_datetime,
      :wait_for_page_to_load,
      :field_by_xpath,
      :field_with_id
      
    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
benschwarz-webrat-0.3.2.1 lib/webrat/core/methods.rb
brynary-webrat-0.3.2.1 lib/webrat/core/methods.rb