
support using assertions on arbitrary stringlike objects
Reported by Josh Nichols | April 15th, 2009 @ 10:40 PM
Currently, the assertions are hardcoded to matching against response_body. The matchers are able to be called on any 'stringlike' object, so it'd be useful to be able to use the assertions on any object as well.
For example, with the rspec matchers, you currently can do:
within '.pagination' do |scope|
scope.should contain("1")
end
But, there's no way to do this with test/unit. Ideally, you'd be able to:
within '.pagination' do |scope|
assert_contains("1", scope)
end
I've forked and branched to support this for all the assertions: http://github.com/technicalpickl...
Comments and changes to this ticket
-
gaffo May 7th, 2009 @ 06:57 PM
- Assigned user set to Bryan Helmkamp
- Tag changed from assertions to assertions, verify
- State changed from new to awaiting-merge
Interesting patch. Can you give an example of what you'd use this to test with html and test code? Need to verify the patch.
-
Josh Nichols May 16th, 2009 @ 11:16 PM
Here's an example:
<div id="recurring_events"> <a href="/events/1">Hackfest</a> </div> <div id="special_events"> <a href="/events/2">Barcamp Boston</a> </div>
So, I'd want to test that certain events are under recurring_events or special events:
within "#recrring_events" do |scope| assert_contains "Hackfest", scope end within "#special_events" do |scope| assert_contains "Barcamp Boston", scope end
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby Acceptance Testing for Web applications.