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
supportinglock_threads
(5.1+).