Fix timezones

This commit is contained in:
Alberto Miedes Garcés
2017-05-15 20:39:59 +02:00
parent ad8aba0739
commit d4752491f8

View File

@@ -196,13 +196,13 @@ describe 'ConsulSchema' do
end
it 'only returns date and hour for created_at' do
created_at = Time.new(2017, 12, 31, 9, 30, 15).in_time_zone(Time.zone)
created_at = Time.zone.parse("2017-12-31 9:30:15")
create(:proposal, created_at: created_at)
response = execute('{ proposals { edges { node { public_created_at } } } }')
received_timestamps = extract_fields(response, 'proposals', 'public_created_at')
expect(received_timestamps.first).to include('09:00:00')
expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00")
end
it 'only retruns tags with kind nil or category' do
@@ -258,13 +258,13 @@ describe 'ConsulSchema' do
end
it 'only returns date and hour for created_at' do
created_at = Time.new(2017, 12, 31, 9, 30, 15).in_time_zone(Time.zone)
created_at = Time.zone.parse("2017-12-31 9:30:15")
create(:debate, created_at: created_at)
response = execute('{ debates { edges { node { public_created_at } } } }')
received_timestamps = extract_fields(response, 'debates', 'public_created_at')
expect(received_timestamps.first).to include('09:00:00')
expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00")
end
it 'only retruns tags with kind nil or category' do
@@ -378,13 +378,13 @@ describe 'ConsulSchema' do
end
it 'only returns date and hour for created_at' do
created_at = Time.new(2017, 12, 31, 9, 30, 15).in_time_zone(Time.zone)
created_at = Time.zone.parse("2017-12-31 9:30:15")
create(:comment, created_at: created_at)
response = execute('{ comments { edges { node { public_created_at } } } }')
received_timestamps = extract_fields(response, 'comments', 'public_created_at')
expect(received_timestamps.first).to include('09:00:00')
expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00")
end
end
@@ -426,13 +426,13 @@ describe 'ConsulSchema' do
end
it 'only returns date and hour for created_at' do
created_at = Time.new(2017, 12, 31, 9, 30, 15).in_time_zone(Time.zone)
created_at = Time.zone.parse("2017-12-31 9:30:15")
create(:proposal_notification, created_at: created_at)
response = execute('{ proposal_notifications { edges { node { public_created_at } } } }')
received_timestamps = extract_fields(response, 'proposal_notifications', 'public_created_at')
expect(received_timestamps.first).to include('09:00:00')
expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00")
end
it 'only links proposal if public' do
@@ -660,13 +660,13 @@ describe 'ConsulSchema' do
end
it 'only returns date and hour for created_at' do
created_at = Time.new(2017, 12, 31, 9, 30, 15).in_time_zone(Time.zone)
created_at = Time.zone.parse("2017-12-31 9:30:15")
create(:vote, created_at: created_at)
response = execute('{ votes { edges { node { public_created_at } } } }')
received_timestamps = extract_fields(response, 'votes', 'public_created_at')
expect(received_timestamps.first).to include('09:00:00')
expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00")
end
end