How to test a plugin with an around_filter?


Does anybody know how to test a plugin module that looks like the one below? It's designed to be included by a controller, typically the application controller.

My specific questions are:

- Can I get at my do_before and do_after methods from a unit test to probe them individually?
- How can I set up a fake request into which I can stuff various values for the HTTP_REFERER header?
- How can I then get an appropriate fake reponse?

Also, is using a class variable the correct way to hold my_data?

module MyModule

   @@my_data = []
   @@my_data << %w( foo bar baz )

   def self.included(controller)
     controller.around_filter :my_method


   def my_method


   def do_before
     unless request.env['HTTP_REFERER'].blank?
       # do stuff, using my @@data

   def do_after
     # do stuff with response.body


I have tried mangling a functional test and also looked at various plugins from the usual suspects[1-3] but the penny still hasn't dropped.


Thanks and regards,
Andy Stewart