using timecop for interactions + whitespaces removed

This commit is contained in:
Florian Staudacher 2012-04-15 03:10:18 +02:00
parent d328cdaa96
commit d9d7bbb74b
3 changed files with 15 additions and 13 deletions

View file

@ -1,9 +1,9 @@
atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0', atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
'xmlns:georss' => 'http://www.georss.org/georss', 'xmlns:georss' => 'http://www.georss.org/georss',
'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/', 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/',
'xmlns:media' => 'http://purl.org/syndication/atommedia', 'xmlns:media' => 'http://purl.org/syndication/atommedia',
'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0',
'xmlns:ostatus' => 'http://ostatus.org/schema/1.0', 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0',
'xmlns:statusnet' => 'http://status.net/schema/api/1/', 'xmlns:statusnet' => 'http://status.net/schema/api/1/',
:id => "#{@user.public_url}.atom", :id => "#{@user.public_url}.atom",
:root_url => "#{@user.public_url}"}) do |feed| :root_url => "#{@user.public_url}"}) do |feed|
@ -14,13 +14,13 @@ atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
feed.logo "#{@user.person.profile.image_url(:thumb_small)}" feed.logo "#{@user.person.profile.image_url(:thumb_small)}"
feed.updated @posts[0].created_at if @posts.length > 0 feed.updated @posts[0].created_at if @posts.length > 0
feed.tag! :link, :rel => 'avatar', :type => 'image/jpeg', 'media:width' => '100', feed.tag! :link, :rel => 'avatar', :type => 'image/jpeg', 'media:width' => '100',
'media:height' => '100', :href => "#{@user.profile.image_url}" 'media:height' => '100', :href => "#{@user.profile.image_url}"
feed.tag! :link, :href => "#{AppConfig[:pubsub_server]}", :rel => 'hub' feed.tag! :link, :href => "#{AppConfig[:pubsub_server]}", :rel => 'hub'
feed.author do |author| feed.author do |author|
author.name @user.name author.name @user.name
author.uri local_or_remote_person_path(@user.person, :absolute => true) author.uri local_or_remote_person_path(@user.person, :absolute => true)
author.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/person' author.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/person'
author.tag! 'poco:preferredUsername', @user.username author.tag! 'poco:preferredUsername', @user.username
author.tag! 'poco:displayName', @user.person.name author.tag! 'poco:displayName', @user.person.name
@ -36,5 +36,5 @@ atom_feed({'xmlns:thr' => 'http://purl.org/syndication/thread/1.0',
entry.tag! 'activity:verb', 'http://activitystrea.ms/schema/1.0/post' entry.tag! 'activity:verb', 'http://activitystrea.ms/schema/1.0/post'
entry.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/note' entry.tag! 'activity:object-type', 'http://activitystrea.ms/schema/1.0/note'
end end
end end
end end

View file

@ -36,7 +36,7 @@ describe UsersController do
it 'should 404 if no user is found' do it 'should 404 if no user is found' do
get :user_photo, :username => 'none' get :user_photo, :username => 'none'
response.should_not be_success response.should_not be_success
end end
end end
describe '#public' do describe '#public' do
@ -45,7 +45,7 @@ describe UsersController do
get :public, :username => @user.username, :format => :atom get :public, :username => @user.username, :format => :atom
response.body.should include(sm.text) response.body.should include(sm.text)
end end
it 'renders xml if atom is requested with clickalbe urls' do it 'renders xml if atom is requested with clickalbe urls' do
sm = Factory(:status_message, :public => true, :author => @user.person) sm = Factory(:status_message, :public => true, :author => @user.person)
@user.person.posts.each do |p| @user.person.posts.each do |p|

View file

@ -9,10 +9,12 @@ describe Diaspora::Relayable do
describe 'interacted_at' do describe 'interacted_at' do
it 'sets the interacted at of the parent to the created at of the relayable post' do it 'sets the interacted at of the parent to the created at of the relayable post' do
relayable = build_object Timecop.freeze do
relayable.save relayable = build_object
if relayable.parent.respond_to?(:interacted_at) #I'm sorry. relayable.save
relayable.parent.interacted_at.to_i.should == relayable.created_at.to_i if relayable.parent.respond_to?(:interacted_at) #I'm sorry.
relayable.parent.interacted_at.to_i.should == relayable.created_at.to_i
end
end end
end end
end end