Increase precision of pricelist #2741

This commit is contained in:
Martin Lensment 2015-07-03 12:11:35 +03:00
parent 527f65ebfb
commit fa77056f81
3 changed files with 29 additions and 47 deletions

View file

@ -19,11 +19,24 @@ describe 'EPP Domain', epp: true do
Fabricate(:contact, code: 'FIXED:JURIDICAL_1234', ident_type: 'bic')
Fabricate(:reserved_domain)
Fabricate(:blocked_domain)
Fabricate(:pricelist)
Fabricate(:pricelist, valid_to: nil)
@uniq_no = proc { @i ||= 0; @i += 1 }
end
it 'should return error if balance low' do
f = Fabricate(:pricelist, valid_to: Time.zone.now + 1.day, price: 100000)
dn = next_domain_name
response = epp_plain_request(domain_create_xml({
name: { value: dn }
}))
response[:msg].should == "Billing failure - credit balance low"
response[:result_code].should == '2104'
f.delete
end
it 'returns error if contact does not exists' do
response = epp_plain_request(domain_create_xml({
registrant: { value: 'FIXED:CITIZEN_1234' },
@ -332,9 +345,12 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(xml)
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Domain.first.valid_to.should be_within(60).of(1.year.since)
Domain.last.valid_to.should be_within(60).of(1.year.since)
@registrar1.balance.should be < old_balance
@registrar1.cash_account.account_activities.count.should == old_activities + 1
a = @registrar1.cash_account.account_activities.last
a.description.should == "Create #{Domain.last.name}"
a.sum.should == -BigDecimal.new('10.0')
end
it 'does not create a domain with invalid period' do