Assert_throws

Hmm..

With this :
require 'win32ole'
require 'test/unit'
require 'lib/illustratorcs'

class IllustratorCSTest < Test::Unit::TestCase
  
  def testInitialzeBadLotRegions
    assert_raise(WIN32OLERuntimeException) {
      cs =
IllustratorCS.new("D:/svn-sandboxFSFS/ruby/salesmapper/Test1_LotRegionsB
ad.ai")
      }
  end
  
End

I get this :

testInitialzeBadLotRegions(IllustratorCSTest):
NameError: uninitialized constant
IllustratorCSTest::WIN32OLERuntimeException

D:/svn-sandboxFSFS/ruby/salesmapper/test/unit/IllustratorCSTest.rb:17:in
`testInitialzeBadLotRegions'

Peter J. Fitzgibbons
Applications Manager
Lakewood Homes - "The American Dream Builder"(r)
Peter.Fitzgibbons@Lakewoodhomes.net
(847) 884-8800

···

-----Original Message-----
From: James Edward Gray II [mailto:james@grayproductions.net]
Sent: Monday, September 12, 2005 2:26 PM
To: ruby-talk ML
Subject: Re: Assert_throws

On Sep 12, 2005, at 2:18 PM, Peter Fitzgibbons wrote:

Hello all,

Can someone lead me to a reference for assert_throws? I don't
understand how to reference the expected symbol.

I'm trying to assert that a bad call on WIN32OLE object throws
WIN32OLERuntimeException.

I believe you are looking for:

     assert_raise(WIN32OLERuntimeException) { bad_call_goes_here() }

Throw/catch are a non-exception related Ruby idiom.

Hope that helps.

James Edward Gray II

Hmm..

With this :
require 'win32ole'
require 'test/unit'
require 'lib/illustratorcs'

class IllustratorCSTest < Test::Unit::TestCase

  def testInitialzeBadLotRegions
    assert_raise(WIN32OLERuntimeException) {

Try ::WIN32OLERuntimeException

You need to properly scope the exception, a leading :: puts it at toplevel, but that may be wrong. I don't have a win32 box around to confirm.

···

On 12 Sep 2005, at 12:30, Peter Fitzgibbons wrote:

      cs =
IllustratorCS.new("D:/svn-sandboxFSFS/ruby/salesmapper/Test1_LotRegionsB
ad.ai")
      }
  end

End

I get this :

testInitialzeBadLotRegions(IllustratorCSTest):
NameError: uninitialized constant
IllustratorCSTest::WIN32OLERuntimeException

D:/svn-sandboxFSFS/ruby/salesmapper/test/unit/IllustratorCSTest.rb:17:in
`testInitialzeBadLotRegions'

Peter J. Fitzgibbons
Applications Manager
Lakewood Homes - "The American Dream Builder"(r)
Peter.Fitzgibbons@Lakewoodhomes.net
(847) 884-8800

-----Original Message-----
From: James Edward Gray II [mailto:james@grayproductions.net]
Sent: Monday, September 12, 2005 2:26 PM
To: ruby-talk ML
Subject: Re: Assert_throws

On Sep 12, 2005, at 2:18 PM, Peter Fitzgibbons wrote:

Hello all,

Can someone lead me to a reference for assert_throws? I don't
understand how to reference the expected symbol.

I'm trying to assert that a bad call on WIN32OLE object throws
WIN32OLERuntimeException.

I believe you are looking for:

     assert_raise(WIN32OLERuntimeException) { bad_call_goes_here() }

Throw/catch are a non-exception related Ruby idiom.

Hope that helps.

James Edward Gray II

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04