mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Added creator and updator
This commit is contained in:
parent
52d662a8cb
commit
50673f6dda
5 changed files with 106 additions and 48 deletions
|
@ -1,10 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Country do
|
||||
before :all do
|
||||
@epp_user = Fabricate(:country)
|
||||
end
|
||||
|
||||
context 'about class' do
|
||||
it 'should have versioning enabled?' do
|
||||
Country.paper_trail_enabled_for_model?.should == true
|
||||
|
@ -30,6 +26,14 @@ describe Country do
|
|||
it 'should not have any versions' do
|
||||
@country.versions.should == []
|
||||
end
|
||||
|
||||
it 'should not have any creator' do
|
||||
@country.creator_str.should == nil
|
||||
end
|
||||
|
||||
it 'should not have any updater' do
|
||||
@country.updator_str.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
|
@ -42,7 +46,7 @@ describe Country do
|
|||
@country.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should not have one version' do
|
||||
it 'should not have a version' do
|
||||
with_versioning do
|
||||
@country.versions.should == []
|
||||
@country.name = 'New name'
|
||||
|
@ -50,5 +54,28 @@ describe Country do
|
|||
@country.versions.size.should == 1
|
||||
end
|
||||
end
|
||||
|
||||
it 'should have creator' do
|
||||
PaperTrail.whodunnit = 'test-user'
|
||||
|
||||
with_versioning do
|
||||
@country = Fabricate(:country)
|
||||
@country.name = 'Updated name'
|
||||
@country.save
|
||||
@country.creator_str.should == 'test-user'
|
||||
@country.updator_str.should == 'test-user'
|
||||
end
|
||||
end
|
||||
|
||||
it 'should have creator' do
|
||||
PaperTrail.whodunnit = 'test-user-2'
|
||||
|
||||
with_versioning do
|
||||
@country.name = 'Updated name'
|
||||
@country.save
|
||||
@country.updator_str.should == 'test-user-2'
|
||||
@country.creator_str.should == nil # Factory does not have it
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue