test/test_joint.rb in joint-0.5.5 vs test/test_joint.rb in joint-0.6.0
- old
+ new
@@ -156,10 +156,15 @@
should "respond with false when asked if the attachment is nil?" do
subject.image.nil?.should be(false)
subject.file.nil?.should be(false)
end
+ should "respond with false when asked if the attachment is blank?" do
+ subject.image.blank?.should be(false)
+ subject.file.blank?.should be(false)
+ end
+
should "clear assigned attachments so they don't get uploaded twice" do
Mongo::Grid.any_instance.expects(:put).never
subject.save
end
end
@@ -245,10 +250,15 @@
should "respond with true when asked if the attachment is nil?" do
subject.image = nil
subject.image.nil?.should be(true)
end
+ should "respond with true when asked if the attachment is blank?" do
+ subject.image = nil
+ subject.image.blank?.should be(true)
+ end
+
should "clear nil attachments after save and not attempt to delete again" do
Mongo::Grid.any_instance.expects(:delete).once
subject.image = nil
subject.save
Mongo::Grid.any_instance.expects(:delete).never
@@ -321,9 +331,11 @@
setup do
@model_class = Class.new do
include MongoMapper::Document
plugin Joint
attachment :file, :required => true
+
+ def self.name; "Foo"; end
end
end
should "work" do
model = @model_class.new
\ No newline at end of file