Sha256: 23104c1325fedcf340daf9e7e966bab052128f4f2a8cc006131de4e9205ba2c6

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

module Kernel
  alias_method :cleanup, :binding
end

class Binding
  def after_spec
    
    eval 'before do
      mod = Object
      @_constants_before_spec_ = mod.constants
    end
    '
    
    eval 'after do  
      mod = Object
      constants_to_remove = mod.constants - @_constants_before_spec_

      # puts "Will remove constants: #{constants_to_remove.inspect}"
      constants_to_remove.each { |const| mod.send(:remove_const, const) }
    end
  '
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-cleanup-1.0.0 lib/rspec-cleanup.rb