test/unit/test_roachclip.rb in roachclip-0.1.0 vs test/unit/test_roachclip.rb in roachclip-0.1.1

- old
+ new

@@ -67,9 +67,19 @@ assert_equal @fname, d.image_name assert_equal File.size(@test_file_path), d.image_size end + should "destroy thumbs when image set to nil" do + @doc.image = nil + @doc.save! + + d = Doc.find(@doc.id) + # until joint supports clearing IDs + assert_raises(Mongo::GridFileNotFound) { d.image_thumb.read } + assert_raises(Mongo::GridFileNotFound) { d.image_large.read } + end + should "have thumb and large" do assert @doc.image_thumb.size > 0 assert @doc.image_large.size > 0 assert_equal 'fonz_thumb.jpg', @doc.image_thumb_name