Running Tests in Ruby on Rails1:51 with Jason Seifer
Tests are small, automated Ruby programs that automatically test different parts of your applications. After writing some tests, you can run them using the "rake" command line application. Treehouse Ruby teacher Jason shows you how to run tests in this Quick Tip.
[Treehouse Presents - Quick Tips: How to Run Tests in Ruby on Rails with Jason Seifer]
Hi, I'm Jason. In this Treehouse quick tip, we're going to talk about how to run tests in Ruby on Rails.
Tests are small, automated Ruby programs that automatically test different parts of our applications.
After writing some tests, you can run them using the rake command-line application.
Now let's take a look at how to run all of the tests in our application.
If we wanted to run the tests in our application, we would type the word "rake" followed by the word "test."
This would go through and run the different unit, functional, and integration test in our application.
We can also omit the word "test" and just type "rake." By typing "rake" by itself, that will run the default rake task,
which usually just happens to be test.
If we wanted to run just the unit test, we could say "rake test:units." The same thing happens with functional and integration tests.
There's one other interesting rake test command, which is "rake test:uncommitted."
This will go through and run the test for any uncommitted files in your project.
This is useful when you're working with other developers and don't want to commit that hasn't been tested.
Finally, if you just want to run a single test, you can do that with Ruby command.
Make sure to include the test directory and then type out the path to the test you want to run.
I'm going to run the user test here. And there you go.
As you can see, Rails makes it pretty easy to run our applications tests using the rake command.
Thanks for watching this Treehouse quick tip.
You need to sign up for Treehouse in order to download course files.Sign up