![]() The last one that will make you faster is terminal-notifier-guard. They both serve the same purpose: making sure you don't have to wait long for your tests to run. Zeus is built in Go and has been around for a little while now. Spring is now enabled by default in new Rails projects (4.1+), but you can add it to your current project easily. If you try just one tool, it's one of these! These make sure your full Rails environment doesn't get reloaded before every run. You can even have guard-rspec kick off the whole suite if you want after having fixed your specs, but I personally prefer to kick off full runs "manually" by pressing enter in the Guard terminal. Not enough for you? If you had failed tests on the previous save, it will run only the failed specs the next time, until it's green. With guard-rspec, it will run the RSpec specs related to the file you changed, and only those. The first one, Guard, will watch your files and do stuff whenever they change. I have found that the following combo is really efficient: You want to know if your tests and your code are working or not. Those tools are all great, right? But that's not all! To be really efficient, you want to have feedback as fast as possible. Different strategies are available but we use transactions, it's just rolled back and never committed. It gives you different options in terms of cleaning the database before each test. What happens with all that fake data you ask me? There are a few possibilities but what we prefer is using the Database Cleaner gem. Some people will prefer fixtures, but we prefer to actually hit the database because we find it to be more reliable.įactory Bot (Previously, Factory Girl) has a nice, descriptive way of declaring factories: fine do It is a great tool to create fake data for your tests. This is the create(:client, :inactive) part of the previous example. Isn't that nice and clear? I love it! Factory Girl Here is what an RSpec test can look like: describe Client do This is almost a religion to some people, but we love RSpec. It has a really nice syntax that is easy to pick up and really clear to read. I loved RSpec the minute I discovered it years ago. Let's start with the core tool in our testing: RSpec. In this Deployment Academy post, I'll share the core elements of that toolset. In addition to using Rainforest tests, we use a bunch of testing tools for our Rails applications. At Rainforest, we love testing as it is the best way to ship high quality software.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |