test/test_grip.rb in grip-0.4.2 vs test/test_grip.rb in grip-0.4.3
- old
+ new
@@ -2,12 +2,16 @@
class Foo
include MongoMapper::Document
include Grip
- has_grid_attachment :image
+ has_grid_attachment :image, :resize => {:width=>50,:height=>50}
has_grid_attachment :pdf
+
+ def grip_process_file opts
+ opts[:file]
+ end
end
class GripTest < Test::Unit::TestCase
def setup
MongoMapper.connection.drop_database "test-attachments"
@@ -57,14 +61,11 @@
assert_equal(1, Foo.after_save.collect(&:method).count)
assert_equal(1, Foo.before_destroy.collect(&:method).count)
end
test "saves attachments correctly" do
- # can't get these to pass locally but the
- # files are there and working. WTF??
-
- #assert_equal @image.read, @doc.image
- #assert_equal @pdf.read, @doc.pdf
+ assert_equal "image/png", @doc.image.content_type
+ assert_equal "application/pdf", @doc.pdf.content_type
assert GridFS::GridStore.exist?(MongoMapper.database, @doc.image_path)
assert GridFS::GridStore.exist?(MongoMapper.database, @doc.pdf_path)
end
\ No newline at end of file