User factory now works

This commit is contained in:
Raphael 2010-08-06 13:27:42 -07:00
parent 0f596af5c4
commit f2e327d908
6 changed files with 9 additions and 6 deletions

View file

@ -72,7 +72,6 @@ protected
end
def propagate_retraction
puts 'propagating retraction'
Retraction.for(self).notify_people
end

View file

@ -8,7 +8,6 @@ class Retraction
retraction.post_id= object.id
retraction.person_id = person_id_from(object)
retraction.type = object.class.to_s
puts retraction.inspect
retraction
end

View file

@ -17,7 +17,6 @@ module Diaspora
end
def push_to(recipients)
puts "recipients are #{recipients.inspect}"
unless recipients.empty?
recipients.map!{|x| x = x.url + "receive/"}
xml = Post.build_xml_for(self)

View file

@ -20,12 +20,14 @@ Factory.define :person_with_private_key, :parent => :person do |p|
p.serialized_key OpenSSL::PKey::RSA.generate(1024).export
end
Factory.define :person_with_user, :parent => :person_with_private_key do |p|
end
Factory.define :user do |u|
u.sequence(:email) {|n| "bob#{n}@aol.com"}
u.password "bluepin7"
u.password_confirmation "bluepin7"
u.sequence(:person) {|p| Factory.create(:person_with_private_key, :email => "robert-#{p}@grimm.org")}
u.person { |a| Factory.create(:person_with_user, :owner_id => a._id)}
end
Factory.define :status_message do |m|

View file

@ -12,6 +12,11 @@ describe 'making sure the spec runner works' do
User.count.should == 0
end
it 'should factory create a user with a person saved' do
user = Factory.create(:user)
loaded_user = User.first(:id => user.id)
loaded_user.person.owner_id.should == user.id
end
describe 'testing a before do block' do
before do
Factory.create(:user)

View file

@ -3,7 +3,6 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe Retraction do
before do
@user = Factory.create(:user)
@user.person.save
@post = @user.post(:status_message, :message => "Destroy!")
@person = Factory.create(:person)
@user.friends << @person