Refactor of rspec tests for Provider / Provider Account API

Petr Blaho pblaho at redhat.com
Mon Jul 30 11:01:07 UTC 2012


Hi Richard,

I sent my patch again on list without modified tests now - https://lists.fedorahosted.org/pipermail/aeolus-devel/2012-July/011716.html.

I tried the whole Friday to find a way to write my tests to be faster but no success so far.

I have created a task - https://www.aeolusproject.org/redmine/issues/3583
to make sure I do not forgot to refactor it.

I will complete Provider Account API with tests written the same way and then I will start refactor.

I have been looking for all kinds of best practices for writing this kind of tests and I have found nothing.
I found only advices that I was already following - one assert per it, nested context / describe, let blocks, avoid instance variables, do not use before all block.
I like this approach but I did not realized how it fails w/r/t performance until you pointed it out. Thanks for it.

It seems like rspec users either
1) has godly machines so they do not bother with performace of tests
2) do not follow those best practices
3) or I write tests in some twisted and horrible way

I hope for 2 or 3 for the best of the community.

P.S.: CCed to aeolus-devel list to gather more ideas on writing rspec tests for controllers, especially for API ones.

-- 

With regards
Petr Blaho



More information about the aeolus-devel mailing list