1
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
5
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :maximum => 8
6
validation.valid?(stub(:username=>"usernamefdfd"))
10
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :minimum => 2
11
instance = stub(:username=>"u")
12
validation.valid?(instance)
16
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :minimum => 2, :maximum => 8
17
instance = stub(:username=>"udfgdf")
18
validation.valid?(instance)
22
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :is => 2
23
instance = stub(:username=>"u")
24
validation.valid?(instance)
28
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :is => 2
29
instance = stub(:username=>"uu")
30
validation.valid?(instance)
34
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4
35
instance = stub(:username => "aa")
36
validation.valid?(instance)
40
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4
41
instance = stub(:username => "a")
42
validation.valid?(instance)
46
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4
47
instance = stub(:username => "aaaa")
48
validation.valid?(instance)
52
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4
53
instance = stub(:username => "aaaaa")
54
validation.valid?(instance)
58
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4
59
instance = stub(:username => nil)
60
validation.valid?(instance)
65
validation = Validatable::ValidatesLengthOf.new stub_everything, :username, :within => 2..4, :allow_nil => true
66
instance = stub(:username => nil)
67
validation.valid?(instance)
71
options = [:message, :if, :times, :level, :groups, :maximum, :minimum, :is, :within, :allow_nil]
72
Validatable::ValidatesLengthOf.new(stub_everything, :test).must_understand(options.to_blank_options_hash)
b'\\ No newline at end of file'