Sha256: 1d7b7d6e58c1a6bf7d4de735d7c6473b6ff97ed5f53b1a368dd6d4e4904a3710

Contents?: true

Size: 709 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.4 spec/snippets/ramaze/caller_info.rb
ramaze-0.2.1 spec/snippets/ramaze/caller_info.rb
ramaze-0.2.0 spec/snippets/ramaze/caller_info.rb