diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 227f5528b..ce2847aa0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,7 +42,8 @@ module ApplicationHelper objects = parse_objects_from_xml(xml) objects.each do |p| - p.save if p.respond_to?(:person) && p.person + p.save if p.respond_to?(:person) && !(p.person.nil?) #WTF + #p.save if p.respond_to?(:person) && !(p.person == nil) #WTF end end diff --git a/spec/factories.rb b/spec/factories.rb index 5055b0023..ded4bf247 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -30,3 +30,5 @@ end Factory.define :post do |p| end + +Factory.define(:comment) {} \ No newline at end of file diff --git a/spec/helpers/parser_spec.rb b/spec/helpers/parser_spec.rb index 445553e5f..40fe5aea5 100644 --- a/spec/helpers/parser_spec.rb +++ b/spec/helpers/parser_spec.rb @@ -103,16 +103,16 @@ describe "parser in application helper" do it 'should be able to correctly handle comments' do friend = Factory.create(:friend) post = Factory.create(:status_message) + comment = Factory.build(:comment, :post => post, :person => friend, :text => "Freedom!") xml = "#{Friend.first.email} - \n Freedom!\n #{friend.id}\n #{post.id}}\n + #{comment.to_xml} " objects = parse_objects_from_xml(xml) comment = objects.first comment.text.should == "Freedom!" comment.person.should == friend comment.post.should == post - end end