Last active
August 29, 2015 14:25
-
-
Save libbyschuknight/77488077d2d4f09e3f57 to your computer and use it in GitHub Desktop.
Testing Steps when creating a new Rails app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Magic Tricks of Testing (RailsConf) by Sandi Metz | |
https://speakerdeck.com/skmetz/magic-tricks-of-testing-railsconf | |
https://www.youtube.com/watch?v=URSWYvyc42M | |
Once created first model/resource - and have spec files | |
(Need to have run first migration and seeded some data) | |
Break down what you want each model/controller etc to do - e.g. what do I want to get out of the Ingredient model? | |
Controller test | |
Write test controller spec for model_spec.rb file BEFORE doing anything in controller. | |
Test failures will tell you what you need to do... | |
- action | |
- template, view | |
- list e.g. Ingredient.all | |
- write test | |
- run test, watch fail | |
- write code to pass test | |
- run test, watch pass | |
View/Feature tests | |
Write test in features spec folder, for user view | |
rails generate rspec:feature UserCanViewListMeals | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment