Sha256: 92a7d254695a1530be815dbbe2a41248e7319f711a72381fa02a6aa490ce0cae

Contents?: true

Size: 826 Bytes

Versions: 5

Compression:

Stored size: 826 Bytes

Contents

require 'al-test-utils'

class TestValidation < Test::Unit::TestCase
  include AlTestUtils

  priority :must

  priority :normal
  def test_save!
    make_temporary_group do |group|
      group.description = ""

      assert_nothing_raised do
        group.save!
      end

      @group_class.validates_presence_of(:description)
      assert_raises(ActiveLdap::EntryInvalid) do
        group.save!
      end
    end
  end

  def test_validates_presence_of
    make_temporary_group do |group|
      assert_nothing_raised do
        group.description = ""
      end
      assert(group.valid?)
      assert_equal([], group.errors.to_a)

      @group_class.validates_presence_of(:description)
      assert(!group.valid?)
      assert(group.errors.invalid?(:description))
      assert_equal(1, group.errors.size)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-activeldap-0.8.3.1 test/test_validation.rb
ruby-activeldap-0.8.3 test/test_validation.rb
ruby-activeldap-0.8.1 test/test_validation.rb
ruby-activeldap-0.8.0 test/test_validation.rb
ruby-activeldap-0.8.2 test/test_validation.rb