Controller testing in Active Scaffold


You need to have to functionally test your controller when you are using ActiveScaffold. There are pieces of code that tell you how to do that on a normal ror application (ie without ActiveScaffold), like recipe 7.17 on the Rails Cookbook, or a fragment of code in an Active Scaffold application, but they don’t have the full details.


Here is an attempt to give some more detailed step by step instructions on how to do it.

  1. The migration for the example customer model.
  2. The customer model, with the extra function to display the customer code
  3. The customer controller app/controllers/customers_controller.rb, using the Active Scaffold
  4. The fixtures YML file test/fixtures/customers.yml
  5. And here are some functions to test some pages and a full CRUD test