# ANN: assert\_raise\_message

**URL:** <https://www.ruby-forum.com/t/ann-assert-raise-message/110367>\
**Category:** Ruby\
**Created:** [July 25, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/ann-assert-raise-message/110367 "2007-07-25T20:45:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [July 25, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/ann-assert-raise-message/110367/1 "2007-07-25T20:45:24Z")

</div>

Rubies:

I don’t like assert\_raise because the first thing I wanted to check was  
the  
e.message was correct. So I wrote assert\_raise\_message, and wrote that  
up  
as a tutorial on how to use assert\_raise in general:

> **[O'Reilly Media - Technology and Business Training](https://www.oreilly.com)**
>
> Gain technology and business knowledge and hone your skills with learning resources created and curated by O'Reilly's experts: live online training, video, books, our platform has content from 200+ of the world's best publishers.

AKA: [O'Reilly Media - Technology and Business Training](http://tinyurl.com/23tlu5)

assert\_raise\_message works great for test-firsting new assertions,  
because  
assertions should have comprehensive (and comprehensible) diagnostics.  
All  
new assertions should come with tests that they raise the correct  
messages.

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [July 25, 2007, 8:52pm UTC](https://www.ruby-forum.com/t/ann-assert-raise-message/110367/2 "2007-07-25T20:52:03Z")

</div>

On Jul 25, 2007, at 1:44 PM, Phlip wrote:

> I don’t like assert\_raise because the first thing I wanted to check  
> was the  
> e.message was correct.

message = assert\_raise … do  
…  
end  
assert\_equals(…, message)

James Edward G. II
