[rspec-devel] [ rspec-Bugs-6971 ] and_yield does not work when the arity is -1

noreply at rubyforge.org noreply at rubyforge.org
Thu Nov 30 22:03:49 EST 2006


Bugs item #6971, was opened at 2006-11-29 23:06
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6971&group_id=797

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: and_yield does not work when the arity is -1

Initial Comment:
def foo(bar)
  bar.call {|*args|}
end

bar = mock("bar)
bar.should_receive(:call).and_yield
foo(bar)  # Mock 'bar' yielded || to block with arity of -1

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2006-12-01 03:03

Message:
As I understand it, this is the correct behavior:

irb(main):021:0> proc {}.arity
=> -1
irb(main):022:0> proc {||}.arity
=> 0
irb(main):023:0> proc {|arg|}.arity
=> 1
irb(main):024:0> proc {|*args|}.arity
=> -1

In your example, you are yielding 0 orgs to a proc with an arity of -1.

Am I missing something?


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6971&group_id=797


More information about the rspec-devel mailing list