Thanks for the answers
I just looked again at the html rails is generating and in fact the
element I'm looking for looks like this:
<span title="required field">*</span>
not:
<span class="required_field">*</span>
Would I test for this like so:
assert_select "form" do
assert_select("span.title.required field", :count => 13)
end
When I run it, I get the error message:
Expected at least 13 elements matching "span.required_field", found 0.
I installed the recommended gem and using that the test works just fine:
assert_xhtml do
form :xpath! => 'count(.//span[ @title= "required field" ]) =
13'
end
One question however, is there any way to turn off the "...in this
sample..." aspect of the output, as if the does find any errors, it
returns my entire html page.
E.g.
1) Failure:
test_index_view(FormControllerTest)
[c:/ruby/lib/ruby/gems/1.8/gems/assert2-0.5.3/lib/assert2/xhtml.rb:327:in
`assert_xhtml'
/test/functional/form_controller_test.rb:41:in `test_index_view'
/test/functional/form_controller_test.rb:37:in `test_index_view']:
Could not find this reference...
<form xpath!="count(.//span[ @class = "required field" ]) =
13"></form>
...in this sample...
300 lines of html follow
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---