diff options
author | The Lambda Calculus <code@thelambdacalculus.net> | 2011-09-14 07:27:54 +0400 |
---|---|---|
committer | The Lambda Calculus <code@thelambdacalculus.net> | 2011-09-14 07:27:54 +0400 |
commit | 83fc972c61325c04386fd7e3ae57e6c5f4b4d0b1 (patch) | |
tree | 2026192b29f45dc72f16355f7ab7628c398f9d2d | |
parent | 4307de96e2f7b4b1072f1205937ff9500bebdb3d (diff) |
Added RSpec test for #1126
-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 |