Displaying 2 results from an estimated 2 matches for "supercontroller".
2008 Jul 24
0
Speccing a respond_to block outside of a request
...imilar,
I can safely stick most of the code in a superclass.
I am having trouble, however, in speccing the index method in the
superclass.
It could look like this: http://pastie.org/240207
This is the class that the controllers that would actually get called
would inherit from.
I want to describe SuperController#index in a spec, so will need to be
able to manipulate the respond_to method -- any ideas on how i can do
this?
Also, it would be nice to spec that the before filter has been applied,
if there was a way, but the main thing is the index method.
Cheers for any & all assistance,
Doug.
--
Post...
2008 Sep 24
3
caches_page :if not executing (but caches_action :if) does
...eing called - the action is just caching every
time. (If I put a debugger call in the :if block, it never stops.)
If I replace caches_page with caches_action, the if evaluates
correctly.
There are before_filters in the controller, but they do not apply to
this action. (There''s one in the supercontroller but it seems
similarly irrelevant - just trims www. from URLs.)
What am I missing? Did I uncover an :if bug (which I doubt) or am I
misunderstanding?
Full example (also in pastie):
#In this case, the :if is ignored, and all pages cache
class PagesController < ApplicationController
caches_p...