Sha256: 464a63c6de35c94bcc642f93b63fb5fc6a8c06872e8c14c12de4877dc5493a9d

Contents?: true

Size: 709 Bytes

Versions: 22

Compression:

Stored size: 709 Bytes

Contents

require 'spec/helper'

#TODO test parse_backtrace explicitly
describe "Ramaze#caller_info" do

  def foo(n=0)
    Ramaze.caller_info(n)
  end

  def bar
    foo
  end

  def baz
    foo(1)
  end

  it "should report correct informations" do
    file,line,meth=foo()
    file.should == __FILE__
    line.should.match(/\d+/)
    meth.should == 'foo'
  end

  it "should report correct informations on nested defs" do
    file,line,meth=bar()
    file.should == __FILE__
    line.should.match(/\d+/)
    meth.should == 'foo'
  end

  it "should report correct informations on other callers" do
    file,line,meth=baz()
    file.should == __FILE__
    line.should.match(/\d+/)
    meth.should == 'baz'
  end

end

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
ramaze-2009.02 spec/snippets/ramaze/caller_info.rb
ramaze-2009.03 spec/snippets/ramaze/caller_info.rb