[rspec-users] Writing a matcher that accepts a block

Abhik Pramanik abhikp at gmail.com
Wed Jan 5 12:11:27 EST 2011


Hi all,

I'm trying to emulate the have_tag matcher that used to be in rspec-rails. 
How would I do that with the rspec 2 interface?

html.should have_tag("div") do
 with_tag("span")
end

RSpec::Matchers.define won't let me pass in a block. I could extend the 
RSpec::Matchers module but I'm not sure if that's the way to do it anymore. 
Any guidance would be helpful!

Abhik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110105/b81f6887/attachment.html>


More information about the rspec-users mailing list