Sha256: c9f983b755c3527f2ecb2c4ad1d61c47709bbb93c25a44bd7cd8b6baad4c9d20
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib') require 'test/unit' require 'og' require 'og/validation' N::Property.type_checking = false class TC_OgValidation < Test::Unit::TestCase # :nodoc: all class Group; end class User property :name, String validate_unique :name def initialize(name = nil) @name = name end end class Filler property :name, String validate_length :name, :min => 3 belongs_to :group, Group def initialize(name = nil) @name = name end end class Group property :name, String has_many :fillers, Filler validate_related :fillers end def test_all config = { :adapter => 'psql', :database => 'test', :user => 'postgres', :password => 'navelrulez', :connection_count => 2 } Og::Database.drop_db!(config) og = Og::Database.new(config) og.get_connection # validate_unique u1 = User.create('gmosx') u2 = User.new('gmosx') assert !u2.valid? assert_equal 1, u2.errors.count u2.name = 'stella' u2.valid? assert u2.valid? # validate_related f1 = Filler.new('g') f2 = Filler.new('ok') g = Group.create g.add_filler(f1) g.add_filler(f2) assert !g.valid? f1.name = 'george' f1.save f2.name = 'stella' f2.save assert g.valid? og.put_connection og.shutdown end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
og-0.13.0 | test/og/tc_validation.rb |
og-0.14.0 | test/og/tc_validation.rb |
og-0.15.0 | test/og/tc_validation.rb |