class ErgomentumRspec::Matchers::Performance::AllocateObjects
Public Instance Methods
description()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 88 def description "allocates number of objects" end
exactly(expected)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 33 def exactly(expected) @expected = expected @compare = proc { @trace.new_allocations.size == @expected } @message = "" self end
failure_message()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 76 def failure_message "expected #{@message}#{@expected} objects to be allocated; "\ "got #{@trace.new_allocations.size}:\n\n"\ "#{@trace.allocations(alias_paths: true).group_by(:sourcefile, :sourceline, :class).to_text}" end
failure_message_when_negated()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 82 def failure_message_when_negated "expected not #{@message}#{@expected} objects to be allocated; "\ "got #{@trace.new_allocations.size}:\n\n"\ "#{@trace.allocations(alias_paths: true).group_by(:sourcefile, :sourceline, :class).to_text}" end
less_than(expected)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 40 def less_than(expected) @expected = expected @compare = proc { @trace.new_allocations.size < @expected } @message = "less than " self end
matches?(*actual, &block)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 21 def matches?(*actual, &block) @trace = if block AllocationStats.trace(&block) elsif actual.first.is_a?(Proc) AllocationStats.trace(&actual.first) else actual.first end @compare || raise(IncompleteExpectationError) @compare.call end
max(expected)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 54 def max(expected) @expected = expected @compare = proc { @trace.new_allocations.size <= @expected } @message = "max " self end
min(expected)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 61 def min(expected) @expected = expected @compare = proc { @trace.new_allocations.size >= @expected } @message = "min " self end
more_than(expected)
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 47 def more_than(expected) @expected = expected @compare = proc { @trace.new_allocations.size > @expected } @message = "more than " self end
object()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 68 def object self end
objects()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 72 def objects self end
supports_block_expectations?()
click to toggle source
# File lib/ergomentum_rspec/matchers/performance/allocate_objects.rb, line 17 def supports_block_expectations? true end