Status message spec now passes
This commit is contained in:
parent
2b7eeffd5b
commit
44093c9342
4 changed files with 13 additions and 6 deletions
|
|
@ -29,6 +29,11 @@ class Post < ActiveRecord::Base
|
|||
self.post_visibilities.count
|
||||
end
|
||||
|
||||
def diaspora_handle= nd
|
||||
self.person = Person.where(:diaspora_handle => nd).first
|
||||
write_attribute(:diaspora_handle, nd)
|
||||
end
|
||||
|
||||
def self.diaspora_initialize params
|
||||
new_post = self.new params.to_hash
|
||||
new_post.person = params[:person]
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ ActiveRecord::Schema.define(:version => 0) do
|
|||
t.string "diaspora_handle"
|
||||
t.string "guid"
|
||||
t.boolean "pending", :default => false
|
||||
t.integer "user_refs", :default => 0
|
||||
t.string "type"
|
||||
t.text "message"
|
||||
t.integer "status_message_id"
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ module Diaspora
|
|||
xml_author = (owns?(object.post)) ? object.diaspora_handle : object.post.person.diaspora_handle
|
||||
else
|
||||
xml_author = object.diaspora_handle
|
||||
pp xml_author
|
||||
pp salmon_author
|
||||
end
|
||||
|
||||
if (salmon_author.diaspora_handle != xml_author)
|
||||
|
|
@ -158,9 +156,7 @@ module Diaspora
|
|||
on_pod = existing_post(post)
|
||||
log_string = "event=receive payload_type=#{post.class} sender=#{post.diaspora_handle} "
|
||||
if on_pod
|
||||
puts "On pod"
|
||||
if post_visible?(post)
|
||||
puts "visible"
|
||||
if post.mutable?
|
||||
on_pod.caption = post.caption
|
||||
on_pod.save!
|
||||
|
|
@ -183,7 +179,6 @@ module Diaspora
|
|||
|
||||
def add_post_to_aspects(post)
|
||||
Rails.logger.debug("event=add_post_to_aspects user_id=#{self.id} post_id=#{post.id}")
|
||||
puts("event=add_post_to_aspects user_id=#{self.id} post_id=#{post.id}")
|
||||
|
||||
aspects = self.aspects_with_person(post.person)
|
||||
aspects.each do |aspect|
|
||||
|
|
|
|||
|
|
@ -11,6 +11,14 @@ describe StatusMessage do
|
|||
@aspect = @user.aspects.create(:name => "losers")
|
||||
end
|
||||
|
||||
describe '#diaspora_handle=' do
|
||||
it 'sets #person' do
|
||||
person = Factory.create(:person)
|
||||
post = Factory.create(:status_message, :person => @user.person)
|
||||
post.diaspora_handle = person.diaspora_handle
|
||||
post.person.should == person
|
||||
end
|
||||
end
|
||||
it "should have either a message or at least one photo" do
|
||||
n = Factory.build(:status_message, :message => nil)
|
||||
n.valid?.should be_false
|
||||
|
|
|
|||
Loading…
Reference in a new issue