How to test ApplicationController method defined also as a helper method?

Mirko picture Mirko · Jan 19, 2011 · Viewed 30.6k times · Source

In my ApplicationController I have a method defined as a helper method:

helper_method :some_method_here

  • How do I test ApplicationController in RSpec at all?
  • How do I include/call this helper method when testing my views/helpers?

I'm using Rails3 with RSpec2

Answer

Jimmy Cuadra picture Jimmy Cuadra · Jan 19, 2011

You can use an anonymous controller to test your ApplicationController, as describe in the RSpec documentation. There's also a section on testing helpers.