Sha256: 29494a332af7a6322bb3b24d3b8caf9a9b9787e2f9cc81a2d5d1e1a4ac10a5ca

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

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

class FleximageBasicModelTest < Test::Unit::TestCase
  def test_should_have_correct_file_path_with_creation_date_based_storage
    p = PhotoBare.create(:image_file => files(:photo))    
    assert_equal "#{RAILS_ROOT}/public/uploads/#{Time.now.year}/#{Time.now.month}/#{Time.now.day}/#{p.id}.png", p.file_path
  end
  
  def test_should_have_correct_directory_path_with_creation_date_based_storage
    p = PhotoBare.create(:image_file => files(:photo))
    assert_equal "#{RAILS_ROOT}/public/uploads/#{Time.now.year}/#{Time.now.month}/#{Time.now.day}", p.directory_path
  end
  
  
  def test_should_have_correct_file_path_without_creation_date_based_storage
    PhotoBare.use_creation_date_based_directories = false
    p = PhotoBare.create(:image_file => files(:photo))
    assert_equal "#{RAILS_ROOT}/public/uploads/#{p.id}.png", p.file_path
  ensure
    PhotoBare.use_creation_date_based_directories = true
  end
  
  def test_should_have_correct_directory_path_without_creation_date_based_storage
    PhotoBare.use_creation_date_based_directories = false
    p = PhotoBare.create(:image_file => files(:photo))
    assert_equal "#{RAILS_ROOT}/public/uploads", p.directory_path
  ensure
    PhotoBare.use_creation_date_based_directories = true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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