Changeset 453
- Timestamp:
- 06/24/08 10:46:09 (5 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 modified
-
lib/arrow/formvalidator.rb (modified) (1 diff)
-
lib/arrow/template/timedelta.rb (added)
-
spec/arrow/formvalidator_spec.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/arrow/formvalidator.rb
r452 r453 132 132 *(Hash.public_instance_methods(false) - ['[]', '[]=', 'inspect']) 133 133 134 135 136 134 137 135 ### Stringified description of the validator -
trunk/spec/arrow/formvalidator_spec.rb
r446 r453 263 263 it "should untaint both keys and values in complex hash fields if untainting is turned on" do 264 264 profile = { 265 :required => [ 266 'recipe[ingredient][rarity]', 267 ], 265 268 :optional => [ 266 269 'recipe[ingredient][name]', … … 268 271 'recipe[yield]' 269 272 ], 273 :constraints => { 274 'recipe[ingredient][rarity]' => /^([\w\-]+)$/, 275 }, 270 276 :untaint_all_constraints => true, 271 277 } 272 278 args = { 279 'recipe[ingredient][rarity]'.taint => 'super-rare'.taint, 273 280 'recipe[ingredient][name]'.taint => 'nutmeg'.taint, 274 281 'recipe[ingredient][cost]'.taint => '$0.18'.taint, … … 280 287 @validator.valid.should == { 281 288 'recipe' => { 282 'ingredient' => { 'name' => 'nutmeg', 'cost' => '$0.18' },289 'ingredient' => { 'name' => 'nutmeg', 'cost' => '$0.18', 'rarity' => 'super-rare' }, 283 290 'yield' => '2 loaves' 284 291 } … … 286 293 287 294 @validator.valid.keys.all? {|key| key.should_not be_tainted() } 288 @validator.valid. keys.all? {|key| key.should_not be_tainted() }295 @validator.valid.values.all? {|key| key.should_not be_tainted() } 289 296 @validator.valid['recipe'].keys.all? {|key| key.should_not be_tainted() } 290 297 @validator.valid['recipe']['ingredient'].keys.all? {|key| key.should_not be_tainted() } 291 298 @validator.valid['recipe']['yield'].should_not be_tainted() 299 @validator.valid['recipe']['ingredient']['rarity'].should_not be_tainted() 292 300 @validator.valid['recipe']['ingredient']['name'].should_not be_tainted() 293 301 @validator.valid['recipe']['ingredient']['cost'].should_not be_tainted()
