Converted to use Rails Time.zone only to honor app time zone

This commit is contained in:
Priit Tark 2015-04-06 13:47:18 +03:00
parent a42136268f
commit e1041da50f
16 changed files with 34 additions and 31 deletions

View file

@ -140,7 +140,7 @@ describe 'EPP Contact', epp: true do
id.text.length.should == 8
# 5 seconds for what-ever weird lag reasons might happen
cr_date.text.to_time.should be_within(5).of(Time.now)
cr_date.text.to_time.should be_within(5).of(Time.zone.now)
end
it 'successfully saves custom code' do

View file

@ -308,7 +308,7 @@ describe 'EPP Domain', epp: true do
response = epp_plain_request(xml, :xml)
response[:msg].should == 'Command completed successfully'
response[:result_code].should == '1000'
Domain.first.valid_to.should == Date.today + 1.year
Domain.first.valid_to.should == 1.year.since.to_date
end
it 'does not create a domain with invalid period' do
@ -1682,7 +1682,7 @@ describe 'EPP Domain', epp: true do
### RENEW ###
it 'renews a domain' do
exp_date = (Date.today + 1.year)
exp_date = 1.year.since.to_date
xml = @epp_xml.domain.renew(
name: { value: domain.name },
curExpDate: { value: exp_date.to_s },
@ -1690,6 +1690,9 @@ describe 'EPP Domain', epp: true do
)
response = epp_plain_request(xml, :xml)
response[:results][0][:msg].should == 'Command completed successfully'
response[:results][0][:result_code].should == '1000'
ex_date = response[:parsed].css('renData exDate').text
name = response[:parsed].css('renData name').text
ex_date.should == "#{(exp_date + 1.year)} 00:00:00 UTC"
@ -1709,7 +1712,7 @@ describe 'EPP Domain', epp: true do
end
it 'returns an error when period is invalid' do
exp_date = (Date.today + 1.year)
exp_date = (1.year.since.to_date)
xml = @epp_xml.domain.renew(
name: { value: domain.name },
@ -1718,8 +1721,8 @@ describe 'EPP Domain', epp: true do
)
response = epp_plain_request(xml, :xml)
response[:results][0][:result_code].should == '2004'
response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]'
response[:results][0][:result_code].should == '2004'
response[:results][0][:value].should == '4'
end

View file

@ -1,5 +1,5 @@
Fabricator(:keyrelay) do
pa_date { DateTime.now }
pa_date { Time.zone.now }
expiry_relative 'P1W'
key_data_public_key 'abc'
key_data_flags 0

View file

@ -62,7 +62,7 @@ describe Keyrelay do
end
it 'is in expired status' do
kr = Fabricate(:keyrelay, pa_date: DateTime.now - 2.weeks)
kr = Fabricate(:keyrelay, pa_date: Time.zone.now - 2.weeks)
expect(kr.status).to eq('expired')
end

View file

@ -7,7 +7,7 @@ class EppDoc
def start(example_count)
@output.puts '# EPP REQUEST - RESPONSE EXAMPLES'
@output.puts "GENERATED AT: #{Time.now} "
@output.puts "GENERATED AT: #{Time.zone.now} "
@output.puts "EXAMPLE COUNT: #{example_count.count} "
@output.puts "\n---\n\n"
end