From 83fc972c61325c04386fd7e3ae57e6c5f4b4d0b1 Mon Sep 17 00:00:00 2001 From: The Lambda Calculus Date: Tue, 13 Sep 2011 23:27:54 -0400 Subject: [PATCH] Added RSpec test for #1126 --- spec/models/photo_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 97f1d51a9..fe0705069 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -200,5 +200,20 @@ describe Photo do @status_message.destroy }.should change(Photo, :count).by(-1) end + + it 'will delete parent status message iff message is otherwise empty' do + expect { + @photo2.destroy + }.should change(StatusMessage, :count).by(-1) + end + + it 'will not delete parent status message iff message had other content' do + expect { + @status_message.text = "Some text" + @status_message.save + @status_message.reload + @photo2.destroy + }.should_not change(StatusMessage, :count) + end end end