58 failures with mysql
This commit is contained in:
parent
319452537e
commit
cbda6b8c58
12 changed files with 40 additions and 21 deletions
|
|
@ -10,11 +10,11 @@ class Comment < ActiveRecord::Base
|
||||||
include Diaspora::Webhooks
|
include Diaspora::Webhooks
|
||||||
include Encryptable
|
include Encryptable
|
||||||
include Diaspora::Socketable
|
include Diaspora::Socketable
|
||||||
|
include Diaspora::Guid
|
||||||
|
|
||||||
xml_attr :text
|
xml_attr :text
|
||||||
xml_accessor :diaspora_handle
|
xml_accessor :diaspora_handle
|
||||||
xml_accessor :post_guid
|
xml_accessor :post_guid
|
||||||
xml_attr :guid
|
|
||||||
|
|
||||||
belongs_to :post
|
belongs_to :post
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
|
|
@ -34,7 +34,7 @@ class Comment < ActiveRecord::Base
|
||||||
post.guid
|
post.guid
|
||||||
end
|
end
|
||||||
def post_guid= new_post_guid
|
def post_guid= new_post_guid
|
||||||
post = Post.where(:guid => new_post_guid).first
|
self.post = Post.where(:guid => new_post_guid).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def notification_type(user, person)
|
def notification_type(user, person)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ class Contact < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_request
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ class Person < ActiveRecord::Base
|
||||||
include Encryptor::Public
|
include Encryptor::Public
|
||||||
require File.join(Rails.root, 'lib/diaspora/web_socket')
|
require File.join(Rails.root, 'lib/diaspora/web_socket')
|
||||||
include Diaspora::Socketable
|
include Diaspora::Socketable
|
||||||
|
include Diaspora::Guid
|
||||||
|
|
||||||
xml_attr :guid
|
|
||||||
xml_attr :diaspora_handle
|
xml_attr :diaspora_handle
|
||||||
xml_attr :url
|
xml_attr :url
|
||||||
xml_attr :profile, :as => Profile
|
xml_attr :profile, :as => Profile
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ class Post < ActiveRecord::Base
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include ROXML
|
include ROXML
|
||||||
include Diaspora::Webhooks
|
include Diaspora::Webhooks
|
||||||
|
include Diaspora::Guid
|
||||||
|
|
||||||
xml_attr :guid
|
|
||||||
xml_attr :diaspora_handle
|
xml_attr :diaspora_handle
|
||||||
xml_attr :public
|
xml_attr :public
|
||||||
xml_attr :created_at
|
xml_attr :created_at
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ class Request < ActiveRecord::Base
|
||||||
include Diaspora::Webhooks
|
include Diaspora::Webhooks
|
||||||
include ROXML
|
include ROXML
|
||||||
|
|
||||||
xml_attr :sender_handle
|
xml_accessor :sender_handle
|
||||||
xml_attr :recipient_handle
|
xml_accessor :recipient_handle
|
||||||
|
|
||||||
belongs_to :sender, :class_name => 'Person'
|
belongs_to :sender, :class_name => 'Person'
|
||||||
belongs_to :recipient, :class_name => 'Person'
|
belongs_to :recipient, :class_name => 'Person'
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ ActiveRecord::Schema.define(:version => 0) do
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "posts", ["guid"], :name => "index_posts_on_guid"
|
||||||
add_index "posts", ["person_id"], :name => "index_posts_on_person_id"
|
add_index "posts", ["person_id"], :name => "index_posts_on_person_id"
|
||||||
add_index "posts", ["type"], :name => "index_posts_on_type"
|
add_index "posts", ["type"], :name => "index_posts_on_type"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ module Diaspora
|
||||||
xml.contact {
|
xml.contact {
|
||||||
xml.user_id contact.user_id
|
xml.user_id contact.user_id
|
||||||
xml.person_id contact.person_id
|
xml.person_id contact.person_id
|
||||||
|
xml.person_guid contact.person.guid
|
||||||
|
|
||||||
xml.aspects {
|
xml.aspects {
|
||||||
contact.aspects.each do |aspect|
|
contact.aspects.each do |aspect|
|
||||||
|
|
|
||||||
11
lib/diaspora/guid.rb
Normal file
11
lib/diaspora/guid.rb
Normal 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
|
||||||
|
|
@ -103,7 +103,8 @@ describe Diaspora::Exporter do
|
||||||
|
|
||||||
it 'should include post created at time' do
|
it 'should include post created at time' do
|
||||||
doc = Nokogiri::XML::parse(posts_xml)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,13 @@ describe Diaspora::Parser do
|
||||||
retraction = Retraction.for(message)
|
retraction = Retraction.for(message)
|
||||||
xml = retraction.to_diaspora_xml
|
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
|
end
|
||||||
|
|
||||||
context "connecting" do
|
context "connecting" do
|
||||||
|
let(:good_request) { FakeHttpRequest.new(:success)}
|
||||||
let(:good_request) { FakeHttpRequest.new(:success)}
|
|
||||||
it "should create a new person upon getting a person request" do
|
it "should create a new person upon getting a person request" do
|
||||||
remote_user = Factory.create(:user)
|
remote_user = Factory.create(:user)
|
||||||
new_person = remote_user.person
|
new_person = remote_user.person
|
||||||
|
|
@ -53,8 +54,6 @@ describe Diaspora::Parser do
|
||||||
user.receive_salmon xml
|
user.receive_salmon xml
|
||||||
}.should change(Person, :count).by(1)
|
}.should change(Person, :count).by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should activate the Person if I initiated a request to that url" do
|
it "should activate the Person if I initiated a request to that url" do
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ describe Invitation do
|
||||||
let!(:aspect) {user.aspects.create(:name => "Invitees")}
|
let!(:aspect) {user.aspects.create(:name => "Invitees")}
|
||||||
let(:user2) {Factory.create(:user)}
|
let(:user2) {Factory.create(:user)}
|
||||||
before do
|
before do
|
||||||
|
user.invites = 20
|
||||||
|
user.save
|
||||||
@email = 'maggie@example.com'
|
@email = 'maggie@example.com'
|
||||||
Devise.mailer.deliveries = []
|
Devise.mailer.deliveries = []
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ describe User do
|
||||||
|
|
||||||
context "creating invites" do
|
context "creating invites" do
|
||||||
it 'requires your aspect' 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
|
end
|
||||||
|
|
||||||
it 'calls Invitation.invite' do
|
it 'calls Invitation.invite' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue