mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 04:28:27 +02:00
Support for disclosure settings. Tests
This commit is contained in:
parent
64b0481cb2
commit
4e5aecb26d
7 changed files with 119 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Contact do
|
||||
before { create_disclosure_settings }
|
||||
it { should have_one(:address) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
@ -32,11 +33,30 @@ describe Contact do
|
|||
end
|
||||
|
||||
context 'with valid attributes' do
|
||||
before(:each) { @contact = Fabricate(:contact) }
|
||||
before(:each) { @contact = Fabricate(:contact, disclosure: nil) }
|
||||
|
||||
it 'should return true' do
|
||||
expect(@contact.valid?).to be true
|
||||
end
|
||||
|
||||
it 'should have default disclosure' do
|
||||
expect(@contact.disclosure.name).to be true
|
||||
expect(@contact.disclosure.org_name).to be true
|
||||
expect(@contact.disclosure.email).to be true
|
||||
expect(@contact.disclosure.phone).to be false
|
||||
expect(@contact.disclosure.fax).to be false
|
||||
expect(@contact.disclosure.address).to be false
|
||||
end
|
||||
|
||||
it 'should have custom disclosure' do
|
||||
@contact = Fabricate(:contact, disclosure: Fabricate(:contact_disclosure))
|
||||
expect(@contact.disclosure.name).to be true
|
||||
expect(@contact.disclosure.org_name).to be true
|
||||
expect(@contact.disclosure.email).to be true
|
||||
expect(@contact.disclosure.phone).to be true
|
||||
expect(@contact.disclosure.fax).to be true
|
||||
expect(@contact.disclosure.address).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with callbacks' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue