add integration spec for retracting a comment

This commit is contained in:
Jonne Haß 2013-02-28 17:20:33 +01:00
parent ccedb6eff0
commit c5ecc872ce

View file

@ -311,14 +311,26 @@ describe 'a user receives a post' do
context 'retractions' do
it 'should accept retractions' do
message = bob.post(:status_message, :text => "cats", :to => @bobs_aspect.id)
message = bob.post(:status_message, text: "cats", to: @bobs_aspect.id)
retraction = Retraction.for(message)
xml = retraction.to_diaspora_xml
lambda {
zord = Postzord::Receiver::Private.new(alice, :person => bob.person)
expect {
zord = Postzord::Receiver::Private.new(alice, person: bob.person)
zord.parse_and_receive(xml)
}.should change(StatusMessage, :count).by(-1)
}.to change(StatusMessage, :count).by(-1)
end
it 'should accept relayable retractions' do
message = bob.post(:status_message, text: "cats", to: @bobs_aspect.id)
comment = bob.comment! message, "and dogs"
retraction = RelayableRetraction.build(bob, comment)
xml = retraction.to_diaspora_xml
expect {
zord = Postzord::Receiver::Private.new(alice, person: bob.person)
zord.parse_and_receive xml
}.to change(Comment, :count).by(-1)
end
end