Testing Controllers with concerns (RSPEC)

Have a concern called Trackable that I use in many controllers. I want to test the responses for each controller using Trackable in the same file. Any Ideas on good practice for completing this?

Hey @tonytaudesign,

As long as “many” means more than 5, I would build an anonymous inline controller that also includes Trackable, test that, and then write a macro that confirms that each of your controllers includes Trackable.

Here’s a good Railscast where Ryan Bates builds an RSpec controller macro. I often use this in controller specs to verify that actions require or don’t require logins.



Thanks Geoff!