[rspec-devel] view specs (was 'rspec stubbing')

aslak hellesoy aslak.hellesoy at gmail.com
Thu Sep 28 03:56:54 EDT 2006


On 9/28/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> On 9/27/06, Dave Astels <dastels at daveastels.com> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > We need to integrate something like this into RSpec:
> >
> > http://zentest.rubyforge.org/classes/Test/Rails/ViewTestCase.html
>

This allows a view to be verified without going through a controller.
They're just setting variables in the same way a controller would and
then saying render.

> That's more or less where we're already headed w/ view specs.

Is it really? I thought we had to go through a controller in order to
verify a view.

> Right
> now (in the trunk), when you do this:
>
> script/generate rspec_controller Person list new create edit update
>
> You get, in addition to the appropriate production files, specs for:
>
> spec/controllers/person_controller_spec.rb
> spec/views/person_list_view_spec.rb
> spec/views/person_list_new_spec.rb
> spec/views/person_list_create_spec.rb
> spec/views/person_list_edit_spec.rb
> spec/views/person_list_update_spec.rb
>
> You can then use these expectations
>
> response.should_have_tag
> response.should_have_rjs
>
> to spec anything that goes in a view.
>
> We have some work to do on this, like some more useful expectations.
> But we're on the right path i believe.
>
> Cheers,
> David
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the rspec-devel mailing list