mirror of
https://github.com/internetee/registry.git
synced 2025-07-08 20:23:22 +02:00
Logging added for most models
This commit is contained in:
parent
09a816d5a8
commit
c3675c1b2a
46 changed files with 285 additions and 28 deletions
|
@ -2,6 +2,54 @@ require 'rails_helper'
|
|||
|
||||
describe ContactDisclosure do
|
||||
it { should belong_to(:contact) }
|
||||
|
||||
context 'about class' do
|
||||
it 'should have versioning enabled?' do
|
||||
Country.paper_trail_enabled_for_model?.should == true
|
||||
end
|
||||
|
||||
it 'should have custom log prexied table name for versions table' do
|
||||
CountryVersion.table_name.should == 'log_countries'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@contact_disclosure = Country.new
|
||||
end
|
||||
|
||||
it 'should not be valid' do
|
||||
@contact_disclosure.valid?
|
||||
@contact_disclosure.errors.full_messages.should match_array([
|
||||
"Name is missing"
|
||||
])
|
||||
end
|
||||
|
||||
it 'should not have any versions' do
|
||||
@contact_disclosure.versions.should == []
|
||||
end
|
||||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before :all do
|
||||
@contact_disclosure = Fabricate(:contact_disclosure)
|
||||
end
|
||||
|
||||
it 'should be valid' do
|
||||
@contact_disclosure.valid?
|
||||
@contact_disclosure.errors.full_messages.should match_array([])
|
||||
end
|
||||
|
||||
it 'should not have one version' do
|
||||
with_versioning do
|
||||
@contact_disclosure.versions.should == []
|
||||
@contact_disclosure.name = 'New name'
|
||||
@contact_disclosure.save
|
||||
@contact_disclosure.versions.size.should == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '.extract_attributes' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue