[rspec-users] nuby: how spec redirect_to at ApplicationController

Priit Tamboom priit.tamboom at eesti.ee
Fri Aug 24 05:57:26 EDT 2007


On 8/16/07, David Chelimsky <dchelimsky at gmail.com> wrote:
>
> On 8/15/07, Courtenay <court3nay at gmail.com> wrote:
> > On 8/15/07, Priit Tamboom <priit.tamboom at gmail.com> wrote:
>
> > > describe ApplicationController do
> > >    it "method login_required should redirect to home path without
> login" do
> >
> > heh.  "it" is so out of place here :)
>
> I agree. The goal is to describe behaviours of objects, not methods.
> So, I'd write:
>
> it "should redirect anonymous user to home path"
>
> Cheers,
> David
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


Thanks for great answers!

By the way, David, your blog post was good additional help about what to do
with application methods:
http://blog.davidchelimsky.net/articles/2007/06/03/oxymoron-testing-behaviour-of-abstractions

I wonder how far you go just testing "concrete" controllers. For example, if
I move login methods from application controller to module under lib
directory then do you change your style (write separate spec for module) or
just keep testing concrete controllers as usually you do.

Oki,
Priit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070824/8f3dbf9f/attachment-0001.html 


More information about the rspec-users mailing list