Sha256: 2dd91568b62cd56bfac947104ddfd0da987d96b66a5c062a25ace116f46cbb7b

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

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

module Unit
  class ValidatableTest < Test::Unit::TestCase
    expect false do
      validation = stub(:valid? => false, :should_validate? => true, 
                        :attribute => "attribute", :message => "message", :level => 1, :run_after_validate => nil)
      klass = Class.new do
        include Validatable
        validations << validation
      end
      klass.new.valid?
    end

    expect true do
      klass = Class.new do
        include Validatable
      end
      instance = klass.new
      instance.errors.add(:attribute, "message")
      instance.valid?
      instance.errors.empty?
    end
  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validatable-1.3.4 test/unit/validatable_test.rb
validatable-1.3.2 test/unit/validatable_test.rb