58 failures with mysql

This commit is contained in:
Raphael 2010-12-21 17:14:52 -08:00
parent 319452537e
commit cbda6b8c58
12 changed files with 40 additions and 21 deletions

View file

@ -10,11 +10,11 @@ class Comment < ActiveRecord::Base
include Diaspora::Webhooks
include Encryptable
include Diaspora::Socketable
include Diaspora::Guid
xml_attr :text
xml_accessor :diaspora_handle
xml_accessor :post_guid
xml_attr :guid
belongs_to :post
belongs_to :person
@ -34,7 +34,7 @@ class Comment < ActiveRecord::Base
post.guid
end
def post_guid= new_post_guid
post = Post.where(:guid => new_post_guid).first
self.post = Post.where(:guid => new_post_guid).first
end
def notification_type(user, person)

View file

@ -21,7 +21,9 @@ class Contact < ActiveRecord::Base
end
def generate_request
Request.new(:sender => self.user.person, :recipient => self.person)
Request.new(:sender => self.user.person,
:recipient => self.person,
:aspect => aspects.first)
end
private

View file

@ -9,8 +9,8 @@ class Person < ActiveRecord::Base
include Encryptor::Public
require File.join(Rails.root, 'lib/diaspora/web_socket')
include Diaspora::Socketable
include Diaspora::Guid
xml_attr :guid
xml_attr :diaspora_handle
xml_attr :url
xml_attr :profile, :as => Profile

View file

@ -8,8 +8,8 @@ class Post < ActiveRecord::Base
include ApplicationHelper
include ROXML
include Diaspora::Webhooks
include Diaspora::Guid
xml_attr :guid
xml_attr :diaspora_handle
xml_attr :public
xml_attr :created_at

View file

@ -8,8 +8,8 @@ class Request < ActiveRecord::Base
include Diaspora::Webhooks
include ROXML
xml_attr :sender_handle
xml_attr :recipient_handle
xml_accessor :sender_handle
xml_accessor :recipient_handle
belongs_to :sender, :class_name => 'Person'
belongs_to :recipient, :class_name => 'Person'

View file

@ -124,6 +124,7 @@ ActiveRecord::Schema.define(:version => 0) do
t.datetime "updated_at"
end
add_index "posts", ["guid"], :name => "index_posts_on_guid"
add_index "posts", ["person_id"], :name => "index_posts_on_person_id"
add_index "posts", ["type"], :name => "index_posts_on_type"

View file

@ -50,6 +50,7 @@ module Diaspora
xml.contact {
xml.user_id contact.user_id
xml.person_id contact.person_id
xml.person_guid contact.person.guid
xml.aspects {
contact.aspects.each do |aspect|

11
lib/diaspora/guid.rb Normal file
View file

@ -0,0 +1,11 @@
module Diaspora::Guid
def self.included(model)
model.class_eval do
before_create :set_guid
xml_attr :guid
end
end
def set_guid
self.guid ||= ActiveSupport::SecureRandom.hex(8)
end
end

View file

@ -103,7 +103,8 @@ describe Diaspora::Exporter do
it 'should include post created at time' do
doc = Nokogiri::XML::parse(posts_xml)
Time.parse(doc.xpath('//posts/status_message/created_at').first.text).should == @status_message1.created_at
xml_time = Time.zone.parse(doc.xpath('//posts/status_message/created_at').first.text)
xml_time.to_i.should == @status_message1.created_at.to_i
end
end
end

View file

@ -30,11 +30,12 @@ describe Diaspora::Parser do
retraction = Retraction.for(message)
xml = retraction.to_diaspora_xml
proc { user.receive xml, user2.person }.should change(StatusMessage, :count).by(-1)
lambda {
user.receive xml, user2.person
}.should change(StatusMessage, :count).by(-1)
end
context "connecting" do
let(:good_request) { FakeHttpRequest.new(:success)}
it "should create a new person upon getting a person request" do
remote_user = Factory.create(:user)
@ -53,8 +54,6 @@ describe Diaspora::Parser do
user.receive_salmon xml
}.should change(Person, :count).by(1)
end
end
it "should activate the Person if I initiated a request to that url" do

View file

@ -9,6 +9,8 @@ describe Invitation do
let!(:aspect) {user.aspects.create(:name => "Invitees")}
let(:user2) {Factory.create(:user)}
before do
user.invites = 20
user.save
@email = 'maggie@example.com'
Devise.mailer.deliveries = []
end

View file

@ -14,7 +14,9 @@ describe User do
context "creating invites" do
it 'requires your aspect' do
inviter.invite_user("maggie@example.com", wrong_aspect.id).should raise_error ActiveRecord::RecordNotFound
lambda {
inviter.invite_user("maggie@example.com", wrong_aspect.id)
}.should raise_error ActiveRecord::RecordNotFound
end
it 'calls Invitation.invite' do