diff options
Diffstat (limited to 'spec/models/photo_spec.rb')
-rw-r--r-- | spec/models/photo_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
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 |