Why I Overhauled My Rails App’s Tests

When I started the application I was very new to both Ruby and Rails. The tests I wrote were OK. They worked, they tested the code, but they weren’t very good. All of the tests ended up being request specs using RSpec and Capybara. They were very slow; fifty tests ran at around 200 seconds. In the last few months I have learned a lot about Rails. The application itself has been updated incrementally to reflect what I have learned, but the tests were neglected. It was time for a change.

Continue reading

Advertisements

TaskWarrior

TaskWarrior is a fantastic cli todo-list manager. I usually tend to use minimalistic tools, but sometimes the best option is one that has every feature you could possibly need. Setting due dates, priorities, adding notes and a ton of other task-related things are simple once you know the syntax.

You probably won’t use every feature in the tool every day, but it’s easy enough to type “task help” and find what you need. There are a lot of ways to filter the commands and get exactly what you want from each command. Analyzing your progress on different projects or just your progress in general is easy with TaskWarrior’s analytical options.

Continue reading

Test Driven Development

Test Driven Development (TDD) is a method used to write code more efficiently by writing tests (a small amount of code that makes sure your code is working properly) first. The benefits of writing tests are huge. When a test fails you will usually get an error pointing out exactly what is wrong and where to find the problem. This can be exploited to make the development process easier.

Continue reading

Setting Goals

The road to success is paved with goals. If you want to achieve anything you already have goals, but are they contributing to your success? Setting good goals is a great way to make sure you’re on the right track. They help you organize your thoughts and break them down into achievable actions.

Goals have three levels of complexity: long-term, intermediate and small. There should be a natural progression from one level of complexity to the next until you reach that main long-term goal.

Continue reading

Haml

In my Rails projects I use the Haml markup language over the stock ERB language as much as possible. The “markup haiku” that is Haml is much easier to write and maintain. It does have a few quirks, but overall my views have been cleaner and easier to read than the ERB equivalents.

The syntax is dead simple. No more unnecessary end tags or wrapping lines of Ruby in special ERB tags.

Continue reading