Show only priv contacts

This commit is contained in:
Priit Tark 2015-05-11 15:56:31 +03:00
parent e20de5b793
commit 2ed9672eb5
8 changed files with 28 additions and 3 deletions

View file

@ -24,7 +24,6 @@ describe ApiUser do
it 'should be active by default' do
@api_user.active.should == true
end
end
context 'with valid attributes' do

View file

@ -39,6 +39,10 @@ describe Registrar do
@registrar.reference_no.should_not be_blank
@registrar.reference_no.last(10).to_i.should_not == 0
end
it 'should not have priv contacts' do
@registrar.priv_contacts.size.should == 0
end
end
context 'with valid attributes' do
@ -126,5 +130,14 @@ describe Registrar do
registrar.valid?
registrar.errors.full_messages.should == ['Code is forbidden to use']
end
it 'should have priv contacts' do
Fabricate(:contact, registrar: @registrar)
@registrar.reload.priv_contacts.size.should == 1
end
it 'should not have priv contacts' do
@registrar.priv_contacts.size.should == 0
end
end
end