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] 0:00 Hi, I'm Jason. In this Treehouse quick tip, we're going to talk about how to run tests in Ruby on Rails. 0:05 Tests are small, automated Ruby programs that automatically test different parts of our applications. 0:12 After writing some tests, you can run them using the rake command-line application. 0:19 Now let's take a look at how to run all of the tests in our application. 0:25 If we wanted to run the tests in our application, we would type the word "rake" followed by the word "test." 0:29 This would go through and run the different unit, functional, and integration test in our application. 0:36 We can also omit the word "test" and just type "rake." By typing "rake" by itself, that will run the default rake task, 0:44 which usually just happens to be test. 0:52 If we wanted to run just the unit test, we could say "rake test:units." The same thing happens with functional and integration tests. 0:56 There's one other interesting rake test command, which is "rake test:uncommitted." 1:07 This will go through and run the test for any uncommitted files in your project. 1:14 This is useful when you're working with other developers and don't want to commit that hasn't been tested. 1:20 Finally, if you just want to run a single test, you can do that with Ruby command. 1:26 Make sure to include the test directory and then type out the path to the test you want to run. 1:32 I'm going to run the user test here. And there you go. 1:38 As you can see, Rails makes it pretty easy to run our applications tests using the rake command. 1:42 Thanks for watching this Treehouse quick tip. 1:49
You need to sign up for Treehouse in order to download course files.Sign up