2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../spec_helper'
|
2019-02-21 15:38:59 +00:00
|
|
|
require_relative 'fixtures/classes'
|
2017-12-01 15:41:50 +00:00
|
|
|
|
|
|
|
describe 'TracePoint#self' do
|
|
|
|
it 'return the trace object from event' do
|
|
|
|
trace = nil
|
|
|
|
TracePoint.new(:line) { |tp| trace = tp.self }.enable do
|
|
|
|
trace.equal?(self).should be_true
|
|
|
|
end
|
|
|
|
end
|
2019-02-21 15:38:59 +00:00
|
|
|
|
|
|
|
it 'return the class object from a class event' do
|
|
|
|
trace = nil
|
|
|
|
TracePoint.new(:class) { |tp| trace = tp.self }.enable do
|
|
|
|
class TracePointSpec::C
|
|
|
|
end
|
|
|
|
end
|
|
|
|
trace.should equal TracePointSpec::C
|
|
|
|
end
|
2017-12-01 15:41:50 +00:00
|
|
|
end
|