1 require File.dirname(__FILE__) + "/../spec_helper.rb"
2 require 'debugger/interface'
4 describe "DownFrame#execute" do
6 @dbg = mock('Debugger')
7 @interface = mock('Interface')
8 @up = Debugger::DownFrame.new
11 it "moves the eval context down the specified number of frames" do
12 ctxt = MethodContext.current
13 @interface.should_receive(:eval_context).at_least(:once).and_return ctxt.sender.sender.sender
14 @interface.should_receive(:debug_context).at_least(:once).and_return ctxt
15 @interface.should_receive(:eval_context=).with(ctxt.sender)
16 @up.execute(@dbg, @interface, @up.command_regexp.match("down 2"))
19 it "does not move the eval context past the current frame" do
20 ctxt = MethodContext.current
21 @interface.should_receive(:eval_context).at_least(:once).and_return ctxt.sender
22 @interface.should_receive(:debug_context).at_least(:once).and_return ctxt
23 @interface.should_receive(:eval_context=).with(ctxt)
24 @up.execute(@dbg, @interface, @up.command_regexp.match("down 2"))