Class: RSpec::Core::Example

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/rspec.rb

Class Method Summary collapse

Class Method Details

.new(*arguments, &block) ⇒ Object



307
308
309
310
311
312
313
# File 'lib/appmap/rspec.rb', line 307

def self.new(*arguments, &block)
  warn "Wrapping example_block for #{name}" if AppMap::RSpec::LOG
  allocate.tap do |obj|
    arguments[arguments.length - 1] = wrap_example_block(obj, arguments.last) if arguments.last.is_a?(Proc)
    obj.send :initialize, *arguments, &block
  end
end

.wrap_example_block(example, fn) ⇒ Object



295
296
297
298
299
300
301
302
303
304
# File 'lib/appmap/rspec.rb', line 295

def wrap_example_block(example, fn)
  proc do
    AppMap::RSpec.begin_spec example
    begin
      instance_exec(&fn)
    ensure
      AppMap::RSpec.end_spec example
    end
  end
end