On Oct 18, 2008, at 9:16 AM, Pat Maddox wrote:

Scott Taylor <[EMAIL PROTECTED]> writes:

On Oct 18, 2008, at 4:40 AM, Thomas Watson Steen wrote:

Hi

I'm using RSpec in with Ruby on Rails. I've made a helper module
method that generates some HTML and would like to create a rspec
test to validate this HTML. I can of cause use regex to validate it
as a string, but would much rather validate it by traversing the DOM
and checking that the elements I expect is present. Any pointers?

No - that's not really an option. The rails stack has no idea about a
DOM.

Hrm...he's just generating HTML, he should be able to use Hpricot.
Does have_tag work with plain strings, or only in examples where there's a response body? If it's the latter, we should make it work with plain
strings as well.  But Hpricot would certainly be useful I would think.


Yeah.  +1.  Not sure why I didn't think of that.

Scott

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to