module CapybaraTestHelpers::BenchmarkHelpers::ClassMethods
Public Instance Methods
benchmark(method_names)
click to toggle source
Debug: Wraps a method to output its parameters and ellapsed time.
Usage:
benchmark :input_for benchmark def input_for(...)
Calls superclass method
# File lib/capybara_test_helpers/benchmark_helpers.rb, line 75 def benchmark(method_names) prepend(Module.new { Array.wrap(method_names).each do |method_name| define_method(method_name) { |*args, **kwargs, &block| benchmark_method(method_name, args, kwargs) { super(*args, **kwargs, &block) } } end }) method_names end
benchmark_all()
click to toggle source
Debug: Wraps all instance methods of the test helper class to log them.
# File lib/capybara_test_helpers/benchmark_helpers.rb, line 63 def benchmark_all return if defined?(@benchmarked_all) benchmark(instance_methods - superclass.instance_methods - [:lazy_for]) @benchmarked_all = true end
on_test_helper_load()
click to toggle source
Hook: Benchmarks all methods in the class once it's loaded.
Calls superclass method
# File lib/capybara_test_helpers/benchmark_helpers.rb, line 57 def on_test_helper_load super benchmark_all end