Sha256: 52c02e99f41946aded628d4853d831b6527d383d4ec7a17410c7fd8ca7145031

Contents?: true

Size: 840 Bytes

Versions: 10

Compression:

Stored size: 840 Bytes

Contents

module WatirSplash
  # main helper module
  #
  # these methods can be used in specs directly
  module SpecHelper

    # opens the browser at specified url
    def open_browser_at url
      @browser = WatirSplash::Browser.new
      Util.formatter.browser = @browser 
      goto url
    end

    def method_missing name, *args #:nodoc:
      if @browser.respond_to?(name)
        SpecHelper.module_eval %Q[
          def #{name}(*args)
            @browser.send(:#{name}, *args) {yield}
          end
        ]
        @browser.send(name, *args) {yield}
      else
        super
      end
    end

    # make sure that using method 'p' will be invoked on @browser
    # and not Kernel
    # use Kernel.p if you need to dump some variable 
    def p *args #:nodoc:
      @browser.p *args
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
watirsplash-1.4.3 lib/watirsplash/spec_helper.rb
watirsplash-1.4.2 lib/watirsplash/spec_helper.rb
watirsplash-1.4.1 lib/watirsplash/spec_helper.rb
watirsplash-1.4.0 lib/watirsplash/spec_helper.rb
watirsplash-1.3.0 lib/watirsplash/spec_helper.rb
watirsplash-1.2.1 lib/watirsplash/spec_helper.rb
watirsplash-1.2.0 lib/watirsplash/spec_helper.rb
watirsplash-1.1.2 lib/watirsplash/spec_helper.rb
watirsplash-1.1.1 lib/watirsplash/spec_helper.rb
watirsplash-1.1.0 lib/watirsplash/spec_helper.rb