mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
add controller enabled to test helper
If your controller tests load before your model tests the test.rb config will cause model test versions to not work even after setting PaperTrail.enabled to true. See: https://github.com/bjallen/paper_trail/blob/6de04f199e7c6c885f922c231872 d04564fb931c/lib/paper_trail/has_paper_trail.rb#L391
This commit is contained in:
parent
44dcdbaaa3
commit
6e883beb8c
1 changed files with 3 additions and 0 deletions
|
@ -813,11 +813,14 @@ If you disable PaperTrail in your test environment but want to enable it for spe
|
|||
# in test/test_helper.rb
|
||||
def with_versioning
|
||||
was_enabled = PaperTrail.enabled?
|
||||
was_enabled_for_controller = PaperTrail.enabled_for_controller?
|
||||
PaperTrail.enabled = true
|
||||
PaperTrail.enabled_for_controller = true
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
PaperTrail.enabled = was_enabled
|
||||
PaperTrail.enabled_for_controller = was_enabled_for_controller
|
||||
end
|
||||
end
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue