RS; Fixed profile marshalling spec, now CI should pass!
This commit is contained in:
parent
ac45960bbf
commit
8432db34b3
1 changed files with 22 additions and 11 deletions
|
|
@ -154,25 +154,36 @@ describe Diaspora::DiasporaParser do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should marshal a profile for a person' do
|
it 'should marshal a profile for a person' do
|
||||||
|
#Create person
|
||||||
person = Factory.create(:person)
|
person = Factory.create(:person)
|
||||||
|
id = person.id
|
||||||
person.profile = Profile.new(:first_name => 'bob', :last_name => 'billytown', :image_url => "http://clown.com")
|
person.profile = Profile.new(:first_name => 'bob', :last_name => 'billytown', :image_url => "http://clown.com")
|
||||||
|
person.save
|
||||||
|
|
||||||
|
#Cache profile for checking against marshaled profile
|
||||||
old_profile = person.profile
|
old_profile = person.profile
|
||||||
|
old_profile.first_name.should == 'bob'
|
||||||
puts person.profile.inspect
|
|
||||||
|
|
||||||
xml = Post.build_xml_for(person.profile)
|
#Build xml for profile, clear profile
|
||||||
person.profile = nil
|
xml = Post.build_xml_for(person.profile)
|
||||||
person.save
|
reloaded_person = Person.first(:id => id)
|
||||||
|
reloaded_person.profile = nil
|
||||||
|
reloaded_person.save
|
||||||
|
|
||||||
puts person.profile.inspect
|
#Make sure profile is cleared
|
||||||
person.profile.should_be nil
|
Person.first(:id=> id).profile.should be nil
|
||||||
store_objects_from_xml xml
|
old_profile.first_name.should == 'bob'
|
||||||
|
|
||||||
|
#Marshal profile
|
||||||
|
store_objects_from_xml xml
|
||||||
|
|
||||||
|
#Check that marshaled profile is the same as old profile
|
||||||
person = Person.first(:id => person.id)
|
person = Person.first(:id => person.id)
|
||||||
|
|
||||||
person.profile.should == old_profile
|
|
||||||
person.profile.should_not be nil
|
person.profile.should_not be nil
|
||||||
|
person.profile.first_name.should == old_profile.first_name
|
||||||
|
person.profile.last_name.should == old_profile.last_name
|
||||||
|
person.profile.image_url.should == old_profile.image_url
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue