[rspec-users] Step tables - Writing the block for a have_selector matcher

aslak hellesoy aslak.hellesoy at gmail.com
Fri Jan 16 06:26:18 EST 2009

On Fri, Jan 16, 2009 at 12:14 PM, Juanma Cervera <lists at ruby-forum.com>wrote:

> Ok.
> I have solved my problem.
> Because I am using spanish for wrinting my features, I didn't paste the
> exact sentences of the code I was using, and pasted instead a
> "manual-translated similar" code.
> And nobody could see the problem. Never more.
> The problem was that I was writing the block for the have_selector with
> do...end instead of {...}
> And it didn't work in these case.
> Is this a bug or is it a special feature of this construct.

You have to use {} in this case. {} and do..end have different precedence
rules in the Ruby language.

In this case, when you use do..end, the block gets sent to the #should
method (the leftmost), but if you use {} it gets sent to the #have_selector
method (the rightmost).


> Juanma Cervera
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Aslak (::)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090116/43989240/attachment-0001.html>

More information about the rspec-users mailing list