Frederick Cheung wrote:
> On Feb 17, 11:01�pm, Hello Guy <[email protected]>
> wrote:
>> /^([[:alpha:]]+\s)+\d*$/ like this:
> Looks to me like this regexp means that "my street" cannot match
> (since you've said that each of your words must be finished by a space
> (so i would expect "my street " to pass)).
> Other than that you need to do some detective work: what line is it
> failing on ? with what input ? which validations are failing etc.
>
> Fred
hello,
my test for validates_format_of :street, :with =>
/^[[:alpha:]]+\s{1}*[[:alpha:]])*\d*$/ is this:
def test_street_format
ok = ["on road 7", "yourstreet"]
notok = ["8ue kd9", "die 8.straße 9"]
ok.each do |name|
sp = Me.new(:name => "MyString", :contact_person => "My person",
:location => "Mybla", :postcode => "12345", :street => name, :email =>
"[email protected]")
assert sp.valid? #, sp.errors.full_messages
notok.each do |name|
sp = Me.new(:name => "MyString", :contact_person => "My person",
:location => "Mybla", :postcode => "12345", :street => name, :email =>
"[email protected]")
assert !sp.valid?
end
end
end
is my test not ok?
i hope someone can help me please
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---