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 aspect.save
target_people = target_people | aspect.people target_people = target_people | aspect.people
} }
push_to_people(post, target_people) push_to_people(post, target_people)
end end
def push_to_people(post, people) def push_to_people(post, people)
puts post.inspect
puts post.to_diaspora_xml
puts "Leaving push_to_people"
salmon = salmon(post) salmon = salmon(post)
people.each{|person| people.each{|person|
push_to_person( person, salmon.xml_for( person )) xml = salmon.xml_for person
push_to_person( person, xml)
} }
end end
@ -184,7 +189,10 @@ class User
end end
def salmon( post ) 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 end
######## Commenting ######## ######## Commenting ########

View file

@ -71,19 +71,19 @@ describe User do
describe '#push_to_aspects' do describe '#push_to_aspects' do
it 'should push a post to a aspect' 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) user.push_to_aspects(post, aspect.id)
end end
it 'should push a post to all aspects' do 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) user.push_to_aspects(post, :all)
end end
end end
describe '#push_to_people' do describe '#push_to_people' do
it 'should 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]) user.push_to_people(post, [user2.person, user3.person])
end end
end end