Hello Guy wrote:
> ok thank you. i try this:
> in model:
> validates_format_of :street, :with =>
> /^[[:alpha:]]+\s{1}*[[:alpha:]])*\d*$/
>
> in test:
> def test_street_try
> assert_match(/^[[:alpha:]]+\s{1}*[[:alpha:]])*\d*$/, 'The Road 9')
> end
The // regexp in the validation should be the same one passed to the test.
That's so when you change the validation, the test will still cover it.
That's why I suggested putting the regexp into a constant.
>
> but i become this:
> Finished in 0,0 seconds.
> 0 tests, 0 failures, 0 errors
You are not running any tests, because your assertion should have counted.
Try with this:
assert false
in a test. If your tests don't break, then you are not running them!
--
Phlip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---