Changeset 461
- Timestamp:
- 08/27/08 17:24:56 (3 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 2 modified
-
docs/manual/resources/js/jquery.ThickBox.js (added)
-
docs/manual/resources/js/jquery.js (added)
-
docs/manual/resources/js/manual.js (added)
-
docs/manual/resources/js/search.js (added)
-
lib/arrow/formvalidator.rb (modified) (1 diff)
-
spec/arrow/formvalidator_spec.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/arrow/formvalidator.rb
r453 r461 306 306 def match_boolean( val ) 307 307 rval = nil 308 if ( val =~ /^(t(?:rue)?|y(?:es)?) $/i )308 if ( val =~ /^(t(?:rue)?|y(?:es)?)|1$/i ) 309 309 rval = true 310 elsif ( val =~ /^(no?|f(?:alse)?) $/i )310 elsif ( val =~ /^(no?|f(?:alse)?)|0$/i ) 311 311 rval = false 312 312 end -
trunk/spec/arrow/formvalidator_spec.rb
r453 r461 346 346 end 347 347 348 it "accepts the value '1' for fields with boolean constraints" do 349 params = {'required' => '1', 'bool_constraint' => '1'} 350 351 @validator.validate( params ) 352 353 @validator.should be_okay() 354 @validator.should_not have_errors() 355 356 @validator[:bool_constraint].should be_true() 357 end 358 348 359 it "accepts the value 'false' for fields with boolean constraints" do 349 360 params = {'required' => '1', 'bool_constraint' => 'false'} … … 381 392 it "accepts the value 'n' for fields with boolean constraints" do 382 393 params = {'required' => '1', 'bool_constraint' => 'n'} 394 395 @validator.validate( params ) 396 397 @validator.should be_okay() 398 @validator.should_not have_errors() 399 400 @validator[:bool_constraint].should be_false() 401 end 402 403 it "accepts the value '0' for fields with boolean constraints" do 404 params = {'required' => '1', 'bool_constraint' => '0'} 383 405 384 406 @validator.validate( params )
