Well, start with JsUnit. It sounds like you're more curious about unit testing in general, though.
The things you get from unit testing (if they're done right) are:
- The ability to detect regressions in your code, as you mentioned
- Less-painful integration, since each piece of your code is already tested by itself
- A clear picture of how your code is expected (and not expected) to be used
Unit tests should basically touch any public method in your code. Sometimes you may have reason to test private methods, and I'm sure you can decide when that may be. The goal is simple:
- Test that the method does the right thing with the right input
- Test that the method does the right thing with the wrong input.
In many ways, your tests should define the functionality of your methods.
Sometimes when people write their unit tests, they intentionally "stub out" any integrated code (i.e., method calls that return other data from a database, file, or business logic) and make them return static data instead. This helps you to feel more confident that you're only testing the code present in the logic you're testing.
You may want to read on for more information about good and bad unit testing practices.
Edit: I don't know much about doing this in Ruby on Rails, but you might consider having a look at what some other people are doing. Ultimately, the tools available to you and the structure of your tests is going to depend on your framework and language.