[rspec-users] View-Driven-Development by Behavior-Driven-Development and RSpec
has.sox at gmail.com
Mon Jul 30 05:29:56 EDT 2007
On 7/30/07, Mikel Lindsaar <raasdnil at gmail.com> wrote:
> Dear Nathan,
> What you are sayiing is correct, and in terms of Ruby on Rails, BDD
> _IS_ View Driven development... or at least it should be IMHO.
> At the end of the day, the only thing that matters in a Rails App is
> the Behaviour shown to the user, who has as their only interface, the
> The user can not and should not interact with any models. The user
> MIGHT interact with a controller... (say, having a file download which
> doesn't get sent through a view), but really... views ARE the
> behaviour of a Rails App.
> I found the same thing as you... started with spec'ing my models,
> doing great, getting to controllers.. doing OK... getting to views and
> going "Where did I go wrong?"
> Starting with views and working "backwards" from a Test::Unit point of
> view has definately opened up a lot of RSpec doors for me.
> My $0.02.
I think one thing that would make view first development a really powerful
tool with rspec is a way to keep track of erroneous calls to model methods.
One thing that I am consistently worried about is specing a method in one
place via mocks, a la the view, but forgetting to include that method in the
The way I get around this at the moment, is when I find a method that I want
to have that isn't there yet, I open up the spec for the model and add an
it "should have method bla"
so that it shows up in the pending report. Of course this means that I have
to have the model spec all setup in the first place kind of defeating the
purpose of view first. Well almost. If the view is generated via an rspec
generator then all that is setup.
What would be fantastic is if mock had an option to report calls to
Something like mock( User, :report_pending_methods => :true )
Is there another way to do this that is already in practice?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users