About "A Guide to Testing the Rails"
Intended Audience
This article is for fellow Rubyists looking for more information on test writing and how that fits into Ruby On Rails. If you’re new to test writing or experienced with test writing, but not in Rails, hopefully you’ll gain some practical tips and insight on successful testing.
Assumptions
Just so we’re all on the same page here, I’m making a few assumptions about you.
- You’ve got Ruby installed and know how to run a Ruby script.
- You’ve got Rails installed
- You’ve created a basic Rails application with 1 controller and 1 model.
If you haven’t accomplished all of the above, you might be jumping ahead of yourself. Check out www.rubyonrails.org for some great beginner’s tutorials.
Make sure you have Ruby 1.8.2 or greater and Rails 0.12 or greater.
Also, hats off to xal (and others) for creating this site.
Steve Kellock ::: skellock@gmail.com ::: what-a-day on #rubyonrails
Chris Carter ::: cdcarter@concentrationstudios.com ::: cdcarter in irc :: updated for rails 1.1.x—07/18/06
Contents
- Testing 1-2-3... is this thing on?
- Introducing Test/Unit
- Hello World on Steroids
- The Test Case Life Cycle
- Hey Test/Unit. Assert This!
- The Rails Fly-By
- It's About Frikkin' Time
- Where They Live
- How to Turn Them On
- The 3 Environments
- Why Make This Distinction?
- The Lo-Down on Fixtures
- What They Are
- YAML the Camel is a Mammal with Enamel
- Comma Seperated
- ERb'in It Up
- Fixtures in Action
- Hashes with Special Powers
- Testing Your Models
- Testing Your Controllers
- What Is It?
- An Anatomy Lesson
- The 4 Hashes of the Apocolypse
- Response-Related Assertions
- Tag-Related Assertions
- Routing-Related Assertions
- Testing File Uploads
- Testing Your Mailers
- Additional Resources