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-3.3.3 spec/support/constant_leak_finder.rb
rom-3.3.2 spec/support/constant_leak_finder.rb
rom-3.3.1 spec/support/constant_leak_finder.rb
rom-3.3.0 spec/support/constant_leak_finder.rb
rom-3.2.3 spec/support/constant_leak_finder.rb
rom-3.2.2 spec/support/constant_leak_finder.rb
rom-mapper-0.5.1 spec/support/constant_leak_finder.rb
rom-3.2.1 spec/support/constant_leak_finder.rb
rom-3.2.0 spec/support/constant_leak_finder.rb
rom-3.1.0 spec/support/constant_leak_finder.rb
rom-3.0.3 spec/support/constant_leak_finder.rb
rom-3.0.2 spec/support/constant_leak_finder.rb
rom-3.0.1 spec/support/constant_leak_finder.rb
rom-3.0.0 spec/support/constant_leak_finder.rb
rom-mapper-0.5.0 spec/support/constant_leak_finder.rb
rom-3.0.0.rc2 spec/support/constant_leak_finder.rb
rom-mapper-0.5.0.rc1 spec/support/constant_leak_finder.rb
rom-3.0.0.rc1 spec/support/constant_leak_finder.rb
rom-3.0.0.beta3 spec/support/constant_leak_finder.rb
rom-3.0.0.beta2 spec/support/constant_leak_finder.rb