docbrown/spec/support/initializers/test_prof.rb
rhymes 118762ca9b
Some RSpec fixes (#6757)
* Fix spec/uploaders/profile_image_uploader_spec.rb

* Additional ordering based fixes

* Fix spec/requests/comments_spec.rb

* Fix spec
2020-03-24 13:16:19 -04:00

19 lines
584 B
Ruby

# see <https://test-prof.evilmartians.io/#/let_it_be>
TestProf::LetItBe.configure do |config|
config.register_modifier :readonly do |record, val|
next record unless record.is_a?(::ActiveRecord::Base)
next record unless val
record.tap(&:readonly!)
end
# marks the record as readonly
config.alias_to :let_it_be_readonly, readonly: true
# reloads the record from the DB, with `record.reload`
config.alias_to :let_it_be_changeable, reload: true
# creates a new instance of the same record in memory
config.alias_to :let_it_be_refindable, refind: true
end