Sha256: fe684a824bae06a9fd5fc2b7cde65dff9623f9cc526a0e46bfe1b749685186fe

Contents?: true

Size: 764 Bytes

Versions: 2

Compression:

Stored size: 764 Bytes

Contents

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

    def method_missing name, *args #:nodoc:
      if WatirSplash::Util.formatter.browser.respond_to?(name)
        SpecHelper.module_eval %Q[
          def #{name}(*args)
            WatirSplash::Util.formatter.browser.send(:#{name}, *args) {yield}
          end
        ]
        WatirSplash::Util.formatter.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:
      WatirSplash::Util.formatter.browser.p *args
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watirsplash-2.0.0.rc2 lib/watirsplash/spec_helper.rb
watirsplash-2.0.0.rc1 lib/watirsplash/spec_helper.rb