test/helper.rb in joint-0.5.1 vs test/helper.rb in joint-0.5.2
- old
+ new
@@ -35,6 +35,46 @@
end
def assert_no_grid_difference(&block)
assert_grid_difference(0, &block)
end
+end
+
+class Asset
+ include MongoMapper::Document
+ plugin Joint
+
+ key :title, String
+ attachment :image
+ attachment :file
+end
+
+class BaseModel
+ include MongoMapper::Document
+ plugin Joint
+ attachment :file
+end
+
+class Image < BaseModel; attachment :image end
+class Video < BaseModel; attachment :video end
+
+module JointTestHelpers
+ def all_files
+ [@file, @image, @image2, @test1, @test2]
+ end
+
+ def rewind_files
+ all_files.each { |file| file.rewind }
+ end
+
+ def open_file(name)
+ File.open(File.join(File.dirname(__FILE__), 'fixtures', name), 'r')
+ end
+
+ def grid
+ @grid ||= Mongo::Grid.new(MongoMapper.database)
+ end
+
+ def key_names
+ [:id, :name, :type, :size]
+ end
end
\ No newline at end of file