Testing Your App


Collapse Content

Running Tests

After completing a feature in the tutorial, you can run tests to check that your code is correct. To run tests, enter the following command in the terminal:

 rake test

This is configured to run all the tests until the first error or failure. Look at the tests to see if you've passed everything you're supposed to. If you did, you can go in the tutorial and keep passing the tests! Otherwise, review the tutorial or look at the failed test and try to determine your error. If you're stuck, add a comment to the bottom of the relevant tutorial page.

Tracking progress on Learneroo

You can report the status of your tests to Learneroo to track your progress:

  1. Go to Learneroo.com/settings and copy the API info displayed.
  2. Create a file .env file in your root folder.
  3. Paste the copied info into it, and save the file.

Now when you run rake test, it should report your results to Learneroo.com! After successfully passing the first test check if your progress is marked below.

Env Gem
Note: If you don't have the dotenv-rails gem installed, you should add it to your gemfile, and then run bundle install.

gem 'spring', '~> 1.3.6'
gem 'dotenv-rails', '~> 2.0.2'

Viewing .env
To view the .env in the future on Cloud9, make sure "Show Hidden Files" is enabled.

Challenge

Run rake test in your terminal to run the tests.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]