Module: Minitest::Memory::Expectations
- Defined in:
- lib/minitest/memory.rb
Overview
Minitest::Spec expectations for memory allocation assertions.
These methods are added to Minitest::Expectation when
minitest/spec is loaded.
Instance Method Summary collapse
-
#must_limit_allocations(limits) ⇒ Object
See Minitest::Memory#assert_allocations.
-
#must_limit_retentions(limits) ⇒ Object
See Minitest::Memory#assert_retentions.
-
#wont_allocate(*classes) ⇒ Object
See Minitest::Memory#refute_allocations.
-
#wont_retain(*classes) ⇒ Object
See Minitest::Memory#refute_retentions.
Instance Method Details
#must_limit_allocations(limits) ⇒ Object
See Minitest::Memory#assert_allocations.
_ { code }.must_limit_allocations(String => {count: 10})
256 257 258 |
# File 'lib/minitest/memory.rb', line 256 def must_limit_allocations(limits) ctx.assert_allocations(limits, &target) end |
#must_limit_retentions(limits) ⇒ Object
See Minitest::Memory#assert_retentions.
_ { code }.must_limit_retentions(String => 1)
265 266 267 |
# File 'lib/minitest/memory.rb', line 265 def must_limit_retentions(limits) ctx.assert_retentions(limits, &target) end |
#wont_allocate(*classes) ⇒ Object
See Minitest::Memory#refute_allocations.
_ { code }.wont_allocate(String, Array)
274 275 276 |
# File 'lib/minitest/memory.rb', line 274 def wont_allocate(*classes) ctx.refute_allocations(*classes, &target) end |
#wont_retain(*classes) ⇒ Object
See Minitest::Memory#refute_retentions.
_ { code }.wont_retain(String, Array)
283 284 285 |
# File 'lib/minitest/memory.rb', line 283 def wont_retain(*classes) ctx.refute_retentions(*classes, &target) end |