Added pure PaperTrail stack

This commit is contained in:
Priit Tark 2015-01-28 17:26:26 +02:00
parent ea6bdc19f9
commit 09a816d5a8
27 changed files with 846 additions and 492 deletions

View file

@ -8,6 +8,16 @@ describe Contact do
it { should have_one(:address) }
context 'about class' do
it 'should have versioning enabled?' do
Contact.paper_trail_enabled_for_model?.should == true
end
it 'should have custom log prexied table name for versions table' do
ContactVersion.table_name.should == 'log_contacts'
end
end
context 'with invalid attribute' do
before :all do
@contact = Contact.new
@ -41,6 +51,10 @@ describe Contact do
@contact.valid?
@contact.errors[:phone].should == ["Phone nr is invalid"]
end
it 'should not have any versions' do
@contact.versions.should == []
end
end
context 'with valid attributes' do
@ -57,6 +71,15 @@ describe Contact do
@contact.relations_with_domain?.should == false
end
it 'should not have one version' do
with_versioning do
@contact.versions.should == []
@contact.name = 'New name'
@contact.save
@contact.versions.size.should == 1
end
end
# it 'ico should be valid' do
# @contact.ident_type = 'ico'
# @contact.ident = '1234'