[rspec-users] Variable argument matchers for Cucumber

Tim Hart THart at picagroup.com
Mon Mar 30 15:00:13 EDT 2009


List,

Given a Cucumber script like

Then /^the (?:(first|second|third|fourth) line of the )?(.*) section of the (.*) should be (.*)$/ do |*args|
    #...
end

Cucumber errors with
expected 0 block argument(s), got 4 (Cucumber::ArityMismatchError)

While it's perfectly legal in generic ruby to do this

def foo(&block)
  block.call 1,2,3,4,5
end

foo do |*args|
  #...
End

Is this an intended limitation? I can work around it, but I'll end up with 2 different 'Then' calls that do nothing but call a common method
--
Tim Hart
Senior Software Engineer
PICA Group
615-713-9956 :cell
timothyjhart :Y!
tjhart at me.com :AIM

*****************************************************************************

Disclaimer: This electronic message may contain information that is Confidential or legally privileged. It is intended only for the use of the individual(s) and entity named in the message. If you are not an intended recipient of this message, please notify the sender immediately and delete the material from your computer. Do not deliver, distribute or copy this message and do not disclose its contents or take any action in reliance on the information it contains.

*****************************************************************************




More information about the rspec-users mailing list