Merge remote-tracking branch 'origin/master' into 1556-get-rid-of-th6

This commit is contained in:
Karl Erik Õunapuu 2020-09-07 13:02:57 +03:00
commit 098d777162
No known key found for this signature in database
GPG key ID: C9DD647298A34764
18 changed files with 94 additions and 94 deletions

View file

@ -5,7 +5,6 @@ shop:
registrar: bestnames
registrant: john
transfer_code: 65078d5
registered_at: <%= Time.zone.parse('2010-07-04').to_s(:db) %>
valid_to: <%= Time.zone.parse('2010-07-05').to_s(:db) %>
outzone_at: <%= Time.zone.parse('2010-07-06').to_s(:db) %>
delete_date: 2010-07-07

View file

@ -151,4 +151,44 @@ class DirectoInvoiceForwardJobTest < ActiveSupport::TestCase
DirectoInvoiceForwardJob.run(monthly: true, dry: false)
end
end
def test_sends_each_monthly_invoice_separately
WebMock.reset!
activity = account_activities(:one)
price = billing_prices(:create_one_year)
price.update(duration: '3 years')
activity.update(activity_type: 'create', price: price)
# Creating account activity for second action
another_activity = activity.dup
another_activity.account = accounts(:two)
AccountActivity.skip_callback(:create, :after, :update_balance)
another_activity.created_at = Time.zone.parse('2010-07-05 10:00')
another_activity.save
AccountActivity.set_callback(:create, :after, :update_balance)
response = <<-XML
<?xml version="1.0" encoding="UTF-8"?>
<results>
<Result Type="0" Desc="OK" docid="309902" doctype="ARVE" submit="Invoices"/>
</results>
XML
first_registrar_stub = stub_request(:post, ENV['directo_invoice_url']).with do |request|
body = CGI.unescape(request.body)
(body.include? 'StartDate') && (body.include? 'EndDate') && (body.include? 'bestnames')
end.to_return(status: 200, body: response)
second_registrar_stub = stub_request(:post, ENV['directo_invoice_url']).with do |request|
body = CGI.unescape(request.body)
(body.include? 'StartDate') && (body.include? 'EndDate') && (body.include? 'goodnames')
end.to_return(status: 200, body: response)
DirectoInvoiceForwardJob.run(monthly: true, dry: false)
assert_requested first_registrar_stub
assert_requested second_registrar_stub
end
end

View file

@ -425,6 +425,12 @@ class DomainTest < ActiveSupport::TestCase
assert_not(@domain.force_delete_scheduled?)
end
def test_aliases_registered_at_to_created_at
created_at = Time.zone.parse('2010-07-05 10:00')
domain = Domain.new(created_at: created_at)
assert_equal created_at, domain.registered_at
end
private
def valid_domain

View file

@ -12,7 +12,7 @@ class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase
visit registrant_domain_url(@domain)
assert_text 'Name shop.test'
assert_text "Registered at #{l Time.zone.parse('2010-07-04')}"
assert_text "Registered at #{l @domain.registered_at}"
assert_link 'Best Names', href: registrant_registrar_path(@domain.registrar)
assert_text 'Transfer code'
@ -73,4 +73,4 @@ class RegistrantAreaDomainDetailsTest < ApplicationSystemTestCase
assert_field nil, with: registrant_domain_update_confirm_url(@domain, token: 'a01')
end
end
end