[rspec-devel] [ rspec-Patches-8113 ] Better Watir exception for bad URLs

noreply at rubyforge.org noreply at rubyforge.org
Wed Jan 24 13:08:11 EST 2007


Patches item #8113, was opened at 2007-01-24 09:29
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=8113&group_id=797

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Aslak Hellesøy (aslak_hellesoy)
Assigned to: Aslak Hellesøy (aslak_hellesoy)
Summary: Better Watir exception for bad URLs

Initial Comment:
class Watir::Browser
  def kill!
    close
  end
  
  alias contain_text? contains_text

  alias old_goto goto
  def goto(url)
    begin
      old_goto(url)
    rescue => e
      e.message << "\nURL: #{url}"
      raise e
    end
  end
end


----------------------------------------------------------------------

>Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-01-24 13:08

Message:
A good tip - monkey patch the watir stuff in your spec_helper.rb

module Spec
  module Ui
    class WebappHelper
      def context_setup
        quick_db_web
        @browser = Watir::Browser.new
        ::Win32::Screenshot.setForegroundWindow(ie.getIE.hwnd)
      end
    end
  end
end
require 'spec/ui/watir_helper'

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2007-01-24 10:39

Message:
Add this too, to webapp_helper.rb (and remove it from the rake)

      raise "$RSPEC_IMG_DIR must be defined" if ENV['RSPEC_IMG_DIR'].nil?
      FileUtils.mkdir_p(ENV['RSPEC_IMG_DIR']) unless File.exist?(ENV['RSPEC_IMG_DIR'])


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=8113&group_id=797


More information about the rspec-devel mailing list