Newer
Older
Daniel Vincent Grippi
a validé
# Copyright 2010 Diaspora Inc.
#
# This file is part of Diaspora.
#
# Diaspora is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Diaspora is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Diaspora. If not, see <http://www.gnu.org/licenses/>.
#
require File.dirname(__FILE__) + '/../spec_helper'
describe StatusMessage do
it "should have a message" do
n = Factory.build(:status_message, :message => nil)
n.valid?.should be false
n.message = "wales"
n.valid?.should be true
end
it 'should be postable through the user' do
status = @user.post(:status_message, :message => "Users do things", :to => @aspect.id)
describe "XML" do
it 'should serialize to XML' do
message = Factory.create(:status_message, :message => "I hate WALRUSES!", :person => @user.person)
message.to_xml.to_s.should include "<message>I hate WALRUSES!</message>"
end
it 'should marshal serialized XML to object' do
ilya
a validé
xml = "<statusmessage><message>I hate WALRUSES!</message></statusmessage>"
parsed = StatusMessage.from_xml(xml)
parsed.message.should == "I hate WALRUSES!"
parsed.valid?.should be_true
end
end