[rspec-users] have_tag with a block

David Chelimsky dchelimsky at gmail.com
Tue Feb 3 21:01:50 EST 2009


On Tue, Feb 3, 2009 at 7:52 PM, MarkMT <mark.thomson at ieee.org> wrote:
> This is really a webrat question, but I haven't had any reaction to
> this from the webrat group. Maybe someone here can offer a comment...
>
> I've been fooling around with webrat view matchers in merb / cucumber
> and I'm trying to figure out whether the block parameter in have_tag
> actually does anything. I've tried passing a block with pure nonsense
> in it and the interpreter just seems to accept it and ignore it as if
> it doesn't exist.
>
> Initially I had hoped there was something like 'with_tag' you could
> nest inside a block, but I guess that was a rails thing. However from
> my quick look at the code, although with fairly limited ruby
> experience, I got the impression that 'have_tag' passes any matching
> markup it finds into the block as a parameter. But none of my
> experiments have been able to confirm this.
>
> Does anyone have first hand knowledge of / successful experience with
> have_tag with a block?

Not first hand experience, but I'm looking at the specs in webrat:

http://github.com/brynary/webrat/blob/e5ae16367cfd656617815fd9b9c405bc6bb3a97d/spec/public/matchers_spec.rb

If you scroll down to describe "#have_tag", you'll see a couple of
examples. It looks like your instinct is at least close to correct.

Can you post an example of what you're trying to do?

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list