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

David Chelimsky dchelimsky at gmail.com
Wed Sep 27 23:18:07 EDT 2006


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

That's more or less where we're already headed w/ view specs. 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


More information about the rspec-devel mailing list