user posting spec is now green, now stubbing on the apropriate method

This commit is contained in:
ilya 2010-10-02 12:34:16 -07:00
parent b6a912dd02
commit 7dcde292e1
2 changed files with 13 additions and 5 deletions

View file

@ -166,13 +166,18 @@ class User
aspect.save
target_people = target_people | aspect.people
}
push_to_people(post, target_people)
end
def push_to_people(post, people)
puts post.inspect
puts post.to_diaspora_xml
puts "Leaving push_to_people"
salmon = salmon(post)
people.each{|person|
push_to_person( person, salmon.xml_for( person ))
xml = salmon.xml_for person
push_to_person( person, xml)
}
end
@ -184,7 +189,10 @@ class User
end
def salmon( post )
Salmon::SalmonSlap.create(self, post.to_diaspora_xml)
puts post.inspect
puts post.to_diaspora_xml
created_salmon = Salmon::SalmonSlap.create(self, post.to_diaspora_xml)
created_salmon
end
######## Commenting ########

View file

@ -71,19 +71,19 @@ describe User do
describe '#push_to_aspects' do
it 'should push a post to a aspect' do
user.should_receive(:salmon).twice
user.should_receive(:push_to_person).twice
user.push_to_aspects(post, aspect.id)
end
it 'should push a post to all aspects' do
user.should_receive(:salmon).exactly(3).times
user.should_receive(:push_to_person).exactly(3).times
user.push_to_aspects(post, :all)
end
end
describe '#push_to_people' do
it 'should push to people' do
user.should_receive(:salmon).twice
user.should_receive(:push_to_person).twice
user.push_to_people(post, [user2.person, user3.person])
end
end