small medium large xlarge

Generic-user-small
15 Dec 2010, 22:33
Roy Zinn (3 posts)

Hi,

I guess i’m missing something here…but, I have followed the process of the unit testing and added the tests. when running the rake test command i get 5 tests, 23 assertions, 0 failures, 0 errors what is the 23 assertions means? if they are assertions that actually happend, what I don’t see the error messages?

If it means that there are total of 23 assertions in the tests and none has failed, how come? there should be assertions when setting the price to negative for example…

What am i missing here?

Thanks in advance, Roy.

Generic-user-small
16 Dec 2010, 23:25
Aaron mcLeod (13 posts)

That’s fine. Assertions refer to the number of assert methods you called. They are used for evaluating a value.

Such as assert @record.valid?

That checks if that given model is valid. If it isn’t, the assertion fails, and throws a failure into the test results

Generic-user-small
17 Dec 2010, 11:54
Roy Zinn (3 posts)

Thanks for your reply.

as you wrote, this is the number of assertion called, than why I’m not getting any assertion fail? I did as the tests in the book shows (entered negative number to the product and didn’t get any error message). should i run rake test, rake test:units? does the fixture has anything to do with that? it is not shown in the book what to run and what to expect after adding the fixture. This clearly should fail (i guess) products(:ruby).title as this title already exists.

Thanks again, Roy.

You must be logged in to comment