Its all about Ruby On Rails
Testing ActiveScaffold based Controllers
If we are using ActiveScaffold in a controller, we might want to write test for that controller too. So we can write functional tests for all action that ActiveScaffold added to our controller like index, create, edit, update etc…
Since all these action are added by ActiveScaffold then these tests must go with ActiveScaffold plugin tests itself and I think they are at their place.
So we just need to test that ActiveScaffold is configured for that particular controller and uses the right model by:
assert_not_nil CampusController.active_scaffold_config assert CampusController.active_scaffold_config.model == Campus
Ofcourse, we also need to write tests for custom actions added by us.
| Print article | This entry was posted by Akhil Bansal on December 17, 2008 at 9:05 pm, and is filed under ActiveScaffold, ROR, Rails, Rubyonrails, Tips, rails_plugin, scaffold, testing, tricks. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
Good information. Thanks for Sharing.
about 1 year ago
I like your style of blogging – small and to the point.