Sha256: 834313ce2e24a4249f2e570b0c14eb9ec53c8e989851e28917ff10fde650ec00

Contents?: true

Size: 417 Bytes

Versions: 54

Compression:

Stored size: 417 Bytes

Contents

# Finds leaking constants created during ROM specs
module ConstantLeakFinder
  def self.find(example)
    constants = Object.constants

    example.run

    added_constants = (Object.constants - constants)
    added = added_constants.map(&Object.method(:const_get))
    if added.any? { |mod| mod.ancestors.map(&:name).grep(/\AROM/).any? }
      raise "Leaking constants: #{added_constants.inspect}"
    end
  end
end

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
rom-0.9.0.beta1 spec/support/constant_leak_finder.rb
rom-mapper-0.2.0 spec/support/constant_leak_finder.rb
rom-support-0.1.0 spec/support/constant_leak_finder.rb
rom-0.8.1 spec/support/constant_leak_finder.rb
rom-0.8.0 spec/support/constant_leak_finder.rb
rom-0.7.1 spec/support/constant_leak_finder.rb
rom-0.7.0 spec/support/constant_leak_finder.rb
rom-0.6.2 spec/support/constant_leak_finder.rb
rom-0.6.1 spec/support/constant_leak_finder.rb
rom-0.6.0 spec/support/constant_leak_finder.rb
rom-0.6.0.rc1 spec/support/constant_leak_finder.rb
rom-0.6.0.beta3 spec/support/constant_leak_finder.rb
rom-0.6.0.beta2 spec/support/constant_leak_finder.rb
rom-0.6.0.beta1 spec/support/constant_leak_finder.rb