Sha256: 8195d18697f4dc7b4d600f389268108479d2e1945e08c84b313e24f9da97b2a8

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

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

class FleximageMagicColumnsTest < Test::Unit::TestCase
  def test_should_save_data_in_magic_columns_from_local
    p = PhotoFile.create(:image_file => files(:photo))
    assert_equal 'photo.jpg', p.image_filename
    assert_equal 1024,  p.image_height
    assert_equal 768,   p.image_width
  end
  
  def test_should_save_data_in_magic_columns_from_url
    p = PhotoFile.create(:image_file_url => files(:web_photo))
    assert_equal files(:web_photo), p.image_filename
    assert_equal 110,   p.image_height
    assert_equal 276,   p.image_width
  rescue SocketError
    print '!'
  end
  
  def test_should_delete_magic_columns_when_image_is_deleted
    p = PhotoFile.new(:image_file => files(:photo))
    p.save
    
    p = PhotoFile.find(p.id)
    p.delete_image_file.save
    
    assert_nil p.image_width
    assert_nil p.image_height
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fleximage-1.0.1 test/unit/magic_columns_test.rb
fleximage-1.0.0 test/unit/magic_columns_test.rb