Chapter 8. Testing Plugins

Once you’ve written your plugin, it’s essential that you provide tests that verify its behavior. Writing tests for plugins is for the most part identical to any testing in Rails or Ruby. This section discusses some special issues that must be taken into consideration to test plugins effectively.

Writing Plugin Tests

The plugin generator creates a test folder in your plugins (which we have happily ignored up to this point). However, the importance of testing your code cannot be overstated. Test-driven development not only can improve the reliability and maintainability of your code, but it can actually help you develop faster.

The

Get Rails Plugins: Extending Rails Beyond the Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.