Contact linked test update/refactor #2411

This commit is contained in:
Priit Tark 2015-07-27 15:59:23 +03:00
parent 7fa9fb3c6e
commit a9ba4dbfd2
7 changed files with 16 additions and 10 deletions

View file

@ -3,7 +3,7 @@ Fabricator(:domain) do
valid_to Date.new(2014, 8, 7)
period 1
period_unit 'y'
registrant(fabricator: :registrant)
registrant { Fabricate(:registrant) }
nameservers(count: 3)
admin_domain_contacts(count: 1) { Fabricate(:admin_domain_contact) }
tech_domain_contacts(count: 1) { Fabricate(:tech_domain_contact) }

View file

@ -29,6 +29,7 @@ describe ContactMailer do
before :all do
@domain = Fabricate(:domain)
@contact = @domain.registrant
@contact.reload # until figured out why registrant_domains not loaded
@contact.deliver_emails = true
@contact.email = 'test@example.org' # new email
@mail = ContactMailer.email_updated(@contact)

View file

@ -137,8 +137,8 @@ describe Contact do
end
end
it 'should not have relation' do
@contact.relations_with_domain?.should == false
it 'should not have relation with domains' do
@contact.domains_present?.should == false
end
it 'bic should be valid' do
@ -234,9 +234,15 @@ describe Contact do
it 'should have related domain descriptions hash' do
contact = @domain.registrant
contact.reload # somehow it registrant_domains are empty?
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:registrant] }
end
it 'should have related domain descriptions hash when find directly' do
contact = @domain.registrant
Contact.find(contact.id).related_domain_descriptions.should == { "#{@domain.name}" => [:registrant] }
end
it 'should have related domain descriptions hash' do
contact = @domain.contacts.first
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] }

View file

@ -48,6 +48,7 @@ def create_settings
Setting.client_side_status_editing_enabled = true
# speedup and easier to create fabrications
@fixed_registrar =
Registrar.find_by_name('fixed registrar') ||
Fabricate(:registrar, name: 'fixed registrar', code: 'FIXED')