test/unit/test_images.rb in spontaneous-0.2.0.beta5 vs test/unit/test_images.rb in spontaneous-0.2.0.beta6
- old
+ new
@@ -15,10 +15,11 @@
end
describe "Image fields set using absolute values" do
before do
@image = S::Field::Image.new(:name => "image")
+ @image.prototype = Spontaneous::Prototypes::FieldPrototype.new(@site.model, :image, :image)
end
it "accept and not alter URL values" do
url = "http://example.com/image.png"
@image.value = url
@image.processed_value.must_equal url
@@ -177,10 +178,11 @@
it "have access to the original uploaded file through field.original yyy" do
@image.src.must_equal "/media/00234/0010/rose.jpg"
@image.original.width.must_equal @image.width
@image.original.height.must_equal @image.height
- @image.filepath.must_equal File.expand_path(File.join(Spontaneous.media_dir, "00234/0010/rose.jpg"))
+ md5 = Digest::MD5.file(@src_image).hexdigest
+ @image.filepath.must_equal ["rose.jpg", md5].to_json
end
it "have a 'sizes' config option that generates resized versions" do
assert_has_elements ResizingImageField.size_definitions.keys, [:original, :__ui__, :preview, :thumbnail, :icon, :tall, :reformatted]