Sha256: 5251f2a44714e279dc67024b4f5bf8a1af774a160694f411945d21c35fced030

Contents?: true

Size: 984 Bytes

Versions: 9

Compression:

Stored size: 984 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe CodeBuddy::Stack do

  it 'should create a series of stack frames from an exception' do
    backtrace = [
      "/Users/me/my_app/config.ru:1:in `new'",
      "/Users/me/my_app/config.ru:1"
    ]
    CodeBuddy::StackFrame.expects(:new).with("/Users/me/my_app/config.ru:1:in `new'").returns(frame1=mock)
    CodeBuddy::StackFrame.expects(:new).with("/Users/me/my_app/config.ru:1"         ).returns(frame2=mock)
    mock_exception = mock(:backtrace=>backtrace)
    mock_exception.expects(:is_a?).with(Exception).returns(true)
    stack = CodeBuddy::Stack.new mock_exception
    stack.stack_frames.should == [frame1, frame2]
  end
  
  it 'should save the currently selected stack frame' do
    mock_exception = mock(:backtrace=>'')
    mock_exception.expects(:is_a?).with(Exception).returns(true)
    stack = CodeBuddy::Stack.new mock_exception
    stack.selected = 3
    stack.selected.should == 3
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
code_buddy-0.1.0 spec/stack_spec.rb
code_buddy-0.0.8 spec/stack_spec.rb
code_buddy-0.0.7 spec/stack_spec.rb
code_buddy-0.0.6 spec/stack_spec.rb
code_buddy-0.0.5 spec/stack_spec.rb
code_buddy-0.0.4 spec/stack_spec.rb
code_buddy-0.0.3 spec/stack_spec.rb
code_buddy-0.0.2 spec/stack_spec.rb
code_buddy-0.0.1 spec/stack_spec.rb