[rspec-users] Outside-In with RSpec on Rails

aslak hellesoy aslak.hellesoy at gmail.com
Tue Jul 10 05:27:31 EDT 2007


On 7/10/07, Marcus Ahnve <marcus at ahnve.com> wrote:
> Whether or not to start with the view is a topic of great debate. Many
> agile luminaries propose waiting with the ui for as long as possible,
> whereas 37Signals for example won't start coding without a full HTML
> mockup.
>

I wouldn't call myself an agile luminary, but I am at least a strong proponent.

TDD means "write the test first"
BDD takes this idea to a more general level: "write the client first"
(the outside)

The design/implementation benefits you get from writing the test first
can also be achieved by writing the outside of your app first - it
leads you to write the code that the client needs, rather than trying
to guess it. The client is your test/spec OR a piece of your app that
is "farther out". Same thing really.

Aslak

> I've tried all different ways - even starting with the model - but I
> agree with David, starting with the view seem to result in less
> refactoring.
>
> Cheers /Marcus
>
> On 7/6/07, Jed Hurt <jed.hurt at gmail.com> wrote:
> > Cool. I'll have to give it a try on my next project.
> >
> > On 7/6/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> > > On 7/6/07, Jed Hurt <jed.hurt at gmail.com> wrote:
> > > > I just read 'Mocks Aren't Stubs' and was intrigued by the notion of
> > > > 'outside-in' TDD.
> > > >
> > > > As a Rails developer, I'm curious if others are employing this method
> > > > when developing Rails applications using RSpec. Is it common practice
> > > > (or even practical) to drive the development of a Rails app by
> > > > starting with view specs, then controller specs, then models?
> > >
> > > Common? Not from what I've seen. I think that most ppl seem to start
> > > w/ the controller.
> > >
> > > That said, I've been starting with the views with some success. I find
> > > that when I've started with the controller, I've ended up doing a lot
> > > more refactoring once that slice was done (i.e. a given
> > > view/controller action/model trio) than I do when I start w/ the view.
> > > In other words, the designs that emerge when I start w/ views are
> > > closer to the designs that I want.
> > >
> > > This is just me. I'm not advocating that this will work for everybody.
> > >
> > > David
> > >
> > >
> > > > _______________________________________________
> > > > rspec-users mailing list
> > > > rspec-users at rubyforge.org
> > > > http://rubyforge.org/mailman/listinfo/rspec-users
> > > >
> > > _______________________________________________
> > > rspec-users mailing list
> > > rspec-users at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rspec-users
> > >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
>
>
> --
> http://marcus.ahnve.net
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list