[rspec-users] Mock in lambda?

2010-12-25 Thread Zhi-Qiang Lei
Hi, I have a lambda. Test = lambda { kill(333) } How should I spec if I want to make sure this Test will send kill message with 333? Thanks. Best regards, Zhi-Qiang Lei zhiqiang@gmail.com ___ rspec-users mailing list rspec-users@rubyforge.org ht

Re: [rspec-users] Mock in lambda?

2010-12-25 Thread David Chelimsky
On Sun, Dec 26, 2010 at 12:05 AM, Zhi-Qiang Lei wrote: > Hi, > > I have a lambda. > > Test = lambda { kill(333) } > > How should I spec if I want to make sure this Test will send kill message > with 333? Thanks. Depends on the scope in which the block will be evaluated. Since kill is being calle

Re: [rspec-users] Mock in lambda?

2010-12-25 Thread Zhi-Qiang Lei
Sorry, it is my codes' fault. It works now. On Dec 26, 2010, at 3:47 PM, Zhi-Qiang Lei wrote: > Hi, > > I'm trying to mock the scope. > > Test = lambda { kill(333) } > app = double("test") > app.should_receive(:kill).with(333).once > app.instance_eval Test > > It will say that kill method miss

Re: [rspec-users] Mock in lambda?

2010-12-25 Thread Zhi-Qiang Lei
Hi, I'm trying to mock the scope. Test = lambda { kill(333) } app = double("test") app.should_receive(:kill).with(333).once app.instance_eval Test It will say that kill method miss in app. And to stub a kill method will not help. Can I only define a new class to test it? Thanks. On Dec 26, 201