gems test-prof 0.10.0

latest releases: 1.4.2, 1.4.1, 1.4.0...
5 years ago

Features

  • Add ability to add custom let_it_be modifiers.

In addition to two built-in modifiers (reload and refind), you can add your own:

TestProf::LetItBe.config.register_modifier :reload do |record, val|
  # ignore when `reload: false`
  next record unless val
  # ignore non-ActiveRecord objects
  next record unless record.is_a?(::ActiveRecord::Base)
  record.reload
end

Changes

  • Use RSpec example ID instead of full description for RubyProf/Stackprof report names.

For more complex scenarios feel free to use your own report name generator:

# for RubyProf
TestProf::RubyProf::Listener.report_name_generator = ->(example) { "..." }
# for Stackprof
TestProf::StackProf::Listener.report_name_generator = ->(example) { "..." }
  • Support arrays in let_it_be with modifiers.
# Now you can use modifiers with arrays
let_it_be(:posts, reload: true) { create_pair(:post) }

Other

  • Print warning when ActiveRecordSharedConnection is used in the version of Rails
    supporting lock_threads (5.1+).

Don't miss a new test-prof release

NewReleases is sending notifications on new releases.