Class: HeapScope::RSpecMatchers::RemainHealthy

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

Instance Method Summary collapse

Instance Method Details

#failure_messageObject



90
91
92
93
# File 'lib/heapscope/rspec.rb', line 90

def failure_message
  codes = @report.findings.map { |f| "#{f.code}/#{f.severity}" }.join(", ")
  "expected healthy retention profile, findings: #{codes}"
end

#matches?(proc) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
88
# File 'lib/heapscope/rspec.rb', line 85

def matches?(proc)
  @report = HeapScope.measure(force_gc: true) { proc.call }
  @report.healthy? && @report.findings.none? { |f| f.severity == :high }
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/heapscope/rspec.rb', line 95

def supports_block_expectations?
  true
end