minitest Argument Error

November 4, 2013

To get into the habbit of TDD and to master the fundamentals of ruby I’m making a simple command line application. It’s an app that will track my daily weight, but the goal of writing this app is not what it does, but what I learn from making it.

Like I’ve said before it is really easy to just read tutorial after tutorial soaking in a ton of information, but never really taking the time to apply all of that new material. So, now I’m working on making the rubber hit the pavement and I’m working on a simple ruby app to streatch my abilities.

One of things that I learned today was testing for a raised argument error. Here is the code that I worked on today:

It actually took me awhile to figure this out this morning. These two posts helped me figure it out though:

The problem I was having was that I was creating my object before I was calling my assert_raises statement, just like I do in my first test. But I figured out that you put the code that raises the exception inside of the ‘{}’ right after the assert_raises statement.