So you’ve got the basics of Rails down, but you haven’t really done any testing. Never fear, this course will lead you through everything you need to know to start testing your Rails apps. All you need to bring is a laptop with Wi-Fi and a browser which isn’t Internet Explorer. All coding will be done through our web application, and there will be plenty of lab assistants to help you if you get stuck along the way.
* Test Unit basics
* Testing Rails models, using fixtures, and validation testing.
* Improving our testing code with macros, shoulda basics, and setup/teardown.
* Mocking and Stubbing with Mocha
* Testing the whole Rails stack with Capybara Integration tests
* Using Factory Girl to replace Fixtures
by Noel Rappin
There’s all kinds of discussion on how to make test processes work, and how to make tests fast, but it sometimes seems like there’s not much discussion on how to make tests useful. What makes a BDD test valuable, in that it will save more time that it will cost in maintenance? I’ll claim that there are five things that you should look for in your tests: independence, repeatability, clarity, conciseness, and robustness. These features will make the tests easier to write, easier to verify, and easier to keep consistent as your application becomes more complicated. You’ll leave this talk ready and able to write great tests.
“A testing tool by any other other name would assert as truthy.” – some guy. You’ve seen Rails’ built-in Test::Unit in the morning session. This afternoon, we’ll introduce RSpec, another popular testing tool. We’ll overview basic structure, contexts, “should” expectations, mocking and stubbing. We’ll also cover Rails model, view, controller, routing, helper, and request specs.
23rd–25th April 2012