some small code style changes + final fix for postgres (milliseconds)

+ updated changelog
This commit is contained in:
Florian Staudacher 2012-10-21 16:05:50 +02:00
parent 25b57cdd2a
commit 0057e9ed46
2 changed files with 12 additions and 5 deletions

View file

@ -22,6 +22,7 @@
## Bug Fixes ## Bug Fixes
* Fix issue with interacted_at in post fetcher. [#3607](https://github.com/diaspora/diaspora/pull/3607)
* Fix error with show post Community Spotlight. [#3658](https://github.com/diaspora/diaspora/pull/3658) * Fix error with show post Community Spotlight. [#3658](https://github.com/diaspora/diaspora/pull/3658)
* Fix javascripts problem with read/unread notifications. [#3656](https://github.com/diaspora/diaspora/pull/3656) * Fix javascripts problem with read/unread notifications. [#3656](https://github.com/diaspora/diaspora/pull/3656)
* Fix error with open/close registrations. [#3649](https://github.com/diaspora/diaspora/pull/3649) * Fix error with open/close registrations. [#3649](https://github.com/diaspora/diaspora/pull/3649)

View file

@ -2,8 +2,8 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
require Rails.root.join('lib','diaspora','fetcher','public')
require 'spec_helper' require 'spec_helper'
require Rails.root.join('lib','diaspora','fetcher','public')
# Tests fetching public posts of a person on a remote server # Tests fetching public posts of a person on a remote server
describe PublicFetcher do describe PublicFetcher do
@ -79,6 +79,8 @@ describe PublicFetcher do
context 'created post' do context 'created post' do
before do before do
Timecop.freeze
@now = DateTime.now.utc
@data = JSON.parse(@fixture).select { |item| item['post_type'] == 'StatusMessage' } @data = JSON.parse(@fixture).select { |item| item['post_type'] == 'StatusMessage' }
#save posts to db #save posts to db
@ -87,12 +89,16 @@ describe PublicFetcher do
} }
end end
after do
Timecop.return
end
it 'applies the date from JSON to the record' do it 'applies the date from JSON to the record' do
@data.each do |post| @data.each do |post|
date = ActiveSupport::TimeZone.new('UTC').parse(post['created_at']).to_datetime date = ActiveSupport::TimeZone.new('UTC').parse(post['created_at']).to_i
entry = StatusMessage.find_by_guid(post['guid']) entry = StatusMessage.find_by_guid(post['guid'])
entry.created_at.to_datetime.should eql(date) entry.created_at.to_i.should eql(date)
end end
end end
@ -105,10 +111,10 @@ describe PublicFetcher do
it 'applies now to interacted_at on the record' do it 'applies now to interacted_at on the record' do
@data.each do |post| @data.each do |post|
date = ActiveSupport::TimeZone.new('UTC').parse(@now.to_s).to_datetime date = @now.to_i
entry = StatusMessage.find_by_guid(post['guid']) entry = StatusMessage.find_by_guid(post['guid'])
entry.interacted_at.to_datetime.should eql(date) entry.interacted_at.to_i.should eql(date)
end end
end end
end end