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
fleximage / test / unit / model_test.rb
100644 29 lines (23 sloc) 0.851 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'test/test_helper'
 
PHOTO_PATH = 'test/fixtures/photo.jpg';
 
class FleximageTest < Test::Unit::TestCase
  def test_should_be_valid_with_image
    p = PhotoBare.new(:image_file => MockFile.new(PHOTO_PATH))
    assert p.save, 'Record expected to be allowed to save'
  end
  
  def test_should_require_an_image
    p = PhotoBare.new
    assert !p.save, 'Record expected to not be allowed to save'
  end
  
  def test_should_disable_image_requirement
    PhotoBare.require_image = false;
    p = PhotoBare.new
    assert p.save, 'Record expected to be allowed to save'
  ensure
    PhotoBare.require_image = true;
  end
  
  def test_image_should_create_from_url
    p = PhotoBare.new(:image_file_url => 'http://www.google.com/intl/en_ALL/images/logo.gif')
    assert p.save, "Record expected to be allowed to save after upload via URL"
  end
end