Doug Glidden wrote:
> def test_raise
>   assert_raise ArgumentError {raise ArgumentError.new("basic argument 
> issue")}
> end
> 
> Now there's suddenly an Exception: undefined method 'ArgumentError'... 
> I was more than a little surprised to discover that the parens make a 
> difference here?  Can anyone explain to me _why_ there's a difference?

foo { ... }  is parsed as a method call with a block.

So your code is parsed as:

  assert_raise(ArgumentError() { mode code })

Method names which start with a capital letter are fairly infrequent, 
but are allowed - see for example Integer(x) or Array(x).

Using do...end instead of {...} tips the parsing the right way:

  assert_raise ArgumentError do
    raise ArgumentError.new "basic argument issue"
  end
-- 
Posted via http://www.ruby-forum.com/.