On Jan 5, 2011, at 11:11 AM, Abhik Pramanik wrote:
> 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!
I'd recommend not doing this. Webrat and Capybara matchers both work very well
for this and there is no need to roll your own by hacking RSpec.
html.should have_selector("div span")
FWIW,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users