Sha256: ba53818f1ead5d089256957453caab6737ab8891231a755c64ac4fba018c68d1

Contents?: true

Size: 848 Bytes

Versions: 15

Compression:

Stored size: 848 Bytes

Contents

require './test/helper'

class ValidatorsTest < Test::Unit::TestCase
  def setup
    rebuild_model
  end

  context "using the helper" do
    setup do
      Dummy.validates_attachment :avatar, :presence => true, :content_type => { :content_type => "image/jpg" }, :size => { :in => 0..10.kilobytes }
    end

    should "add the attachment_presence validator to the class" do
      assert Dummy.validators_on(:avatar).any?{ |validator| validator.kind == :attachment_presence }
    end

    should "add the attachment_content_type validator to the class" do
      assert Dummy.validators_on(:avatar).any?{ |validator| validator.kind == :attachment_content_type }
    end

    should "add the attachment_size validator to the class" do
      assert Dummy.validators_on(:avatar).any?{ |validator| validator.kind == :attachment_size }
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
paperclip-3.4.2 test/validators_test.rb
paperclip-3.4.1 test/validators_test.rb
paperclip-3.4.0 test/validators_test.rb
paperclip-3.3.1 test/validators_test.rb
paperclip-3.2.1 test/validators_test.rb
paperclip-3.3.0 test/validators_test.rb
paperclip-3.2.0 test/validators_test.rb
paperclip-3.1.4 test/validators_test.rb
paperclip-3.1.2 test/validators_test.rb
paperclip-3.1.1 test/validators_test.rb
paperclip-3.1.0 test/validators_test.rb
paperclip-3.0.4 test/validators_test.rb
paperclip-3.0.3 test/validators_test.rb
cloudfuji_paperclip-3.0.3 test/validators_test.rb
paperclip-3.0.2 test/validators_test.rb