Sha256: 4ff449b6fa902ed50be1dfd86b9efa21a95a111fd410e05c153487c938885089

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

require File.dirname(__FILE__) + '/../../test/test_helper'

class FleximageFileUploadFromLocalTest < Test::Unit::TestCase
  def test_should_be_valid_with_image
    p = PhotoBare.new(:image_file => files(:photo))
    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'
    assert_equal 1, p.errors.size
    assert_equal 'is required', p.errors.on(:image_file)
  end
  
  def test_should_require_an_valid_image
    p = PhotoBare.new(:image_file => files(:not_a_photo))
    assert !p.save, 'Record expected to not be allowed to save'
    assert_equal 1, p.errors.size
    assert_equal 'was not a readable image', p.errors.on(:image_file)
  end
  
  def test_should_correct_colorspace_and_dpi
    p = PhotoBare.new(:image_file => files(:cmyk))
    image = p.load_image
    assert_equal Magick::RGBColorspace, image.colorspace
    assert_equal '72x72', image.density
    assert_equal 300, image.columns
    assert_equal 300, image.rows
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
tvdeyen-fleximage-1.1.1 test/unit/file_upload_from_local_test.rb
tvdeyen-fleximage-1.0.9 test/unit/file_upload_from_local_test.rb
tvdeyen-fleximage-1.0.8 test/unit/file_upload_from_local_test.rb
tvdeyen-fleximage-1.0.7 test/unit/file_upload_from_local_test.rb
robinboening-fleximage-1.0.6 test/unit/file_upload_from_local_test.rb
robinboening-fleximage-1.0.4 test/unit/file_upload_from_local_test.rb
tvdeyen-fleximage-1.0.5 test/unit/file_upload_from_local_test.rb
fleximage-1.0.4 test/unit/file_upload_from_local_test.rb
dougmcbride-fleximage-1.0.3 test/unit/file_upload_from_local_test.rb
fleximage-1.0.3 test/unit/file_upload_from_local_test.rb
fleximage-1.0.2 test/unit/file_upload_from_local_test.rb
fleximage-1.0.1 test/unit/file_upload_from_local_test.rb
fleximage-1.0.0 test/unit/file_upload_from_local_test.rb