RSS

Recent Comments

Powered by Disqus
Dec
9th
Wed
permalink

assert_contain within a certain scope in webrat

This does work in the current version 0.5.3.

From this cheatsheet it would be intuitive to think this would work

== Targetted actions/matchers



within 'div.pagination' do |scope|

scope.click_link "1"

end



within '.shows' do |scope|

scope.should contain("NFL")

# unfortunately, assertions don't support this currently

end

However the comment does not lie. Finally found the correct way to do this from this slideshare:

assert_have_selector "div.project-title h1 span.client", :content => "Test Client"

NOTE: the :content value does not include nested tags, its just text that is not enclosed by any other tags.

blog comments powered by Disqus