Spec'ing ApplicationController

View: New views
3 Messages — Rating Filter:   Alert me  

Spec'ing ApplicationController

by sbellware :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Folks,

I'd like to spec the behaviors that I'm adding to ApplicationController.  Specifically, I'm adding:

def authenticated?
  session[:username] != nil
end

I described ApplicationController, but couldn't figure out how to call the authenticated method.  I'm probably going about this quite wrongly and would appreciate any hints?

Thanks,
Scott

Re: Spec'ing ApplicationController

by David Chelimsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/14/07, sbellware <sbellware@...> wrote:

>
> Folks,
>
> I'd like to spec the behaviors that I'm adding to ApplicationController.
> Specifically, I'm adding:
>
> def authenticated?
>   session[:username] != nil
> end
>
> I described ApplicationController, but couldn't figure out how to call the
> authenticated method.  I'm probably going about this quite wrongly and would
> appreciate any hints?

The way I handle this is with a shared behaviour that includes specs
for behaviours inherited from ApplicationController, but I run them
against the real controllers.


>
> Thanks,
> Scott
> --
> View this message in context: http://www.nabble.com/Spec%27ing-ApplicationController-tf4270301.html#a12154175
> Sent from the rspec-users mailing list archive at Nabble.com.
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users

Re: Spec'ing ApplicationController

by Priit Tamboom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8/28/07, David Chelimsky <dchelimsky@...> wrote:

> On 8/14/07, sbellware <sbellware@...> wrote:
> >
> > Folks,
> >
> > I'd like to spec the behaviors that I'm adding to ApplicationController.
> > Specifically, I'm adding:
> >
> > def authenticated?
> >   session[:username] != nil
> > end
> >
> > I described ApplicationController, but couldn't figure out how to call the
> > authenticated method.  I'm probably going about this quite wrongly and would
> > appreciate any hints?
>
> The way I handle this is with a shared behaviour that includes specs
> for behaviours inherited from ApplicationController, but I run them
> against the real controllers.
>
>
> >
> > Thanks,
> > Scott
> > --
> > View this message in context: http://www.nabble.com/Spec%27ing-ApplicationController-tf4270301.html#a12154175
> > Sent from the rspec-users mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users@...
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users@...
> http://rubyforge.org/mailman/listinfo/rspec-users
>

I had same question recently, take a look:
http://rubyforge.org/pipermail/rspec-users/2007-August/002760.html

If you want discuss it further, I'm happy to share my nuby knowledge :-)

Oki,
Priit
_______________________________________________
rspec-users mailing list
rspec-users@...
http://rubyforge.org/mailman/listinfo/rspec-users