Sha256: 02a320f6f2dbde3dcf2d638600c0c0ab16daa3b4534ad2095f67649dd516b99b

Contents?: true

Size: 787 Bytes

Versions: 12

Compression:

Stored size: 787 Bytes

Contents

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

class ValidatedPhoto < ActiveRecord::Base
  set_table_name :photo_dbs
  acts_as_fleximage
  
  def validate
    # overiding the validate method
  end
end

class FleximageRequireImageOptionTest < Test::Unit::TestCase
  def test_should_require_image_by_default
    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_should_require_image_when_validate_is_overriden
    p = ValidatedPhoto.new
    assert !p.save, 'Record expected to not be allowed to save'
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

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