[Rspec-devel] Rails controller testing/view testing
aslak.hellesoy at gmail.com
Sat Jul 8 12:33:48 EDT 2006
On 7/7/06, Luke Redpath <luke at agileevolved.com> wrote:
> Hi Guys
> I was wondering how integration of Rails' controller testing features
> into rSpec is coming along.
It's in flux and we're still exploring the best way to do it. Brian
Takita's extension patch that just went in might result in our being
able to leverage more of Rails' built-in tetsing stuff without
reimplementing it ourself.
In any case, here is how I'd like to work with the controller/view layer:
== Integration ==
I'd prefer to use in-browser testing using Watir/Sahi/Selenium rather
than Rails' integration testing approach. -Even if we could do it with
RSpec. -But we should support Rails integration testing with RSpec too
- other people might prefer that over in-browser testing.
== Controller specs ==
The broader rails community seems to favor integration tests more than
controller (functional) tests these days. Personally, I'd like to be
able to write controller specs that verify the behaviour of the
I agree with you that the assert_tag approach is clunky, and I'd love
to be able to use hpricot. I'd also love to be able to run specs over
the controllers without even having to worry about the view.
> I posted a suggestion on here the other day based on something Jay
> Levitt mentioned for testing your views without using something like
> the horrible assert_tag functionality. I've put something together
> that works with Test::Unit using _why's new Hpricot HTML parser
> library and I'd be interested on ideas for working this into rSpec
> for Rails view/controller testing. I'm not really familiar with rSpec
> under the hood yet and have only used it for non-Rails stuff so far.
> Here's what I've got so far:
This looks *very* interesting. In fact, I'd like to explore whether we
should support hpricot out of the RSpec box and ditch an
assert_tag-equivalent approach altogether.
Would you be willing to donate your hpriocot wrapper to RSpec under
our BSD licence?
I can help integrate it more tightly with the RSpec innards.
> Luke Redpath
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
More information about the Rspec-devel