Merge remote-tracking branch 'pamediakopes /fix-originator'
Moved the unit test for this change to into the model_test.rb. [ fix #166 ]
This commit is contained in:
commit
1668bb26ae
|
@ -11,3 +11,5 @@ pkg/*
|
|||
.rbenv-version
|
||||
Gemfile.lock
|
||||
vendor/*
|
||||
.idea
|
||||
.rvmrc
|
||||
|
|
|
@ -97,7 +97,7 @@ module PaperTrail
|
|||
|
||||
# Returns who put the object into its current state.
|
||||
def originator
|
||||
version_class.with_item_keys(self.class.name, id).last.try :whodunnit
|
||||
version_class.with_item_keys(self.class.base_class.name, id).last.try :whodunnit
|
||||
end
|
||||
|
||||
# Returns the object (not a Version) as it was at the given timestamp.
|
||||
|
|
|
@ -517,6 +517,12 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
|
|||
assert_nil Version.last.next
|
||||
end
|
||||
|
||||
should 'should return the correct originator' do
|
||||
PaperTrail.whodunnit = 'Ben'
|
||||
@foo.update_attribute(:name, 'Geoffrey')
|
||||
assert_equal PaperTrail.whodunnit, @foo.originator
|
||||
end
|
||||
|
||||
context 'when destroyed' do
|
||||
setup { @foo.destroy }
|
||||
|
||||
|
|
Loading…
Reference in New Issue