public
Description: Rails plugin for uploading images as resources, with support for resizing, text stamping, and other special effects.
Homepage: http://fleximage.rubyforge.org
Clone URL: git://github.com/Squeegy/fleximage.git
Search Repo:
Fixed that overriding the validate method would cause images to stop being 
validated
Squeegy (author)
Wed Apr 30 13:04:20 -0700 2008
commit  a6c1bde3146fa8c92a6d1d4453378ed285edc8ce
tree    7c190a7995cf2480deecbdd53adc53bd3e3ecec5
parent  aa43e073bd67dbf060725568681b98b1c590be83
...
 
 
 
 
 
...
1
2
3
4
5
0
@@ -1 +1,6 @@
0
+#!/usr/bin/env ruby -wKU
0
+$stdout.sync = true
0
+IO.popen('rstakeout "rake test" lib/fleximage/* lib/fleximage/**/* test/unit/*') do |f|
0
+ puts f.gets until f.eof?
0
+end
...
89
90
91
 
 
 
92
93
94
...
359
360
361
362
 
363
364
365
...
89
90
91
92
93
94
95
96
97
...
362
363
364
 
365
366
367
368
0
@@ -89,6 +89,9 @@
0
           end
0
         end
0
         
0
+ # validation callback
0
+ validate :validate_image
0
+
0
         # The filename of the temp image. Used for storing of good images when validation fails
0
         # and the form needs to be redisplayed.
0
         attr_reader :image_file_temp
0
@@ -359,7 +362,7 @@
0
       end
0
       
0
       # Execute image presence and validity validations.
0
- def validatee #:nodoc:
0
+ def validate_image #:nodoc:
0
         field_name = (@image_file_url && @image_file_url.any?) ? :image_file_url : :image_file
0
                 
0
         if @invalid_image
...
1
2
 
 
 
 
 
 
 
 
 
3
4
5
...
12
13
14
 
 
 
 
 
15
16
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
21
22
23
24
25
26
27
28
29
30
0
@@ -1,5 +1,14 @@
0
 require File.dirname(__FILE__) + '/../../test/test_helper'
0
 
0
+class ValidatedPhoto < ActiveRecord::Base
0
+ set_table_name :photo_dbs
0
+ acts_as_fleximage
0
+
0
+ def validate
0
+ # overiding the validate method
0
+ end
0
+end
0
+
0
 class FleximageRequireImageOptionTest < Test::Unit::TestCase
0
   def test_should_require_image_by_default
0
     p = PhotoBare.new
0
@@ -12,6 +21,11 @@
0
     assert p.save, 'Record expected to be allowed to save'
0
   ensure
0
     PhotoBare.require_image = true
0
+ end
0
+
0
+ def test_should_require_image_when_validate_is_overriden
0
+ p = ValidatedPhoto.new
0
+ assert !p.save, 'Record expected to not be allowed to save'
0
   end
0
 end

Comments

    No one has commented yet.