1.15 Study Log – Rspec is quick to set up!

3h today I woke up and started refactoring another problem with testing in mind. It’s cool to see how differently you need to build something in order to be able to test it. This time I did away with the class variables (@@) and did everything the old fashioned way: passing variables in and returning them out. If nothing else it saved me from having to type lots and lots of @’s in my code!

Rspec is really quick to set up and has fairly readable tests. I am pleasantly surprised. I think the reason why this has stuck more easily than jasmine in js is that backend things seem to be easier to test. There are still a lot of rspec features to be explored, but it’s pretty simple to see if my make_Average method is doing what it should be doing. One interesting side note is that I have been avoiding making classes because I didn’t see the need, but it seems like rspec is built for working with classes – so I learned how to do it! It’s funny how self taught people learn things out of order so often. I feel like that is one of the early things a lot of programmers are taught, but I never saw the need so I never looked into it.

Tell me what you think.

This site uses Akismet to reduce spam. Learn how your comment data is processed.