You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is my first GITHUB post and I am new to ruby so please bear with me. I have looked through the issues logged about faker and have spotted this issue reported previously and fixed. However, having checked I am on the latest version of faker (1.2.0) I am still getting these problems.
The results are bizarre because it does produce both valid and invalid formats that follow the same postcode standards.
For example,
"YS3 8BA" and "YH7 4FN" are both in the format AAN NAA, yet one has a single space and the other has 2 spaces.
"GD7X 7GA" and "YG9W 9LL" are both in the format AANA NAA and again one has a single space and the other has 2 spaces.
I can get around this using the squeeze method as suggested by one of the other posters but thought I should report the bug because the fix doesn't seem to have worked.
Faker::Address.postcode.squeeze(" ")
I checked that the regular expression you are using in Faker to see if it would return invalid for postcodes with 2 spaces (in the correct format). The regex you are using is as follows:
I checked this using Rubular and Expresso tools using the postcode "US6P 7AD" and both indicated this does not match the regex. Removing the space does produce a valid match.
The text was updated successfully, but these errors were encountered:
Hi, this is my first GITHUB post and I am new to ruby so please bear with me. I have looked through the issues logged about faker and have spotted this issue reported previously and fixed. However, having checked I am on the latest version of faker (1.2.0) I am still getting these problems.
My development environment is as follows:
If I run IRB and setup the local for UK then generate a postcode you can see below that it has produced a postcode with two spaces:
rails console
Loading development environment (Rails 4.0.2)
1.9.3p448 :001 > Faker::Config.locale = 'en-gb'
=> "en-gb"
1.9.3p448 :002 > Faker::Address.postcode
=> "WM5 6JY"
Having run this several more times I get the following results:
=> "YS3 8BA" [ Invalid ]
=> "I78 6DJ" [ Invalid ]
=> "YH7 4FN" [ Valid ]
=> "S6H 9PU" [ Valid ]
=> "Y4V 9YP" [ Valid ]
=> "ZE1 1LN" [ Valid ]
=> "W1 2QB" [ Invalid ]
=> "GD7X 7GA" [ Invalid ]
=> "S35 7AL" [ Invalid ]
=> "W9N 0JR" [ Valid ]
=> "G0 5BJ" [ Valid ]
=> "TL8 5BL" [ Invalid ]
=> "YF9P 3DJ" [ Invalid ]
=> "YG9W 9LL" [ Valid ]
The results are bizarre because it does produce both valid and invalid formats that follow the same postcode standards.
For example,
"YS3 8BA" and "YH7 4FN" are both in the format AAN NAA, yet one has a single space and the other has 2 spaces.
"GD7X 7GA" and "YG9W 9LL" are both in the format AANA NAA and again one has a single space and the other has 2 spaces.
I can get around this using the squeeze method as suggested by one of the other posters but thought I should report the bug because the fix doesn't seem to have worked.
Faker::Address.postcode.squeeze(" ")
I checked that the regular expression you are using in Faker to see if it would return invalid for postcodes with 2 spaces (in the correct format). The regex you are using is as follows:
[A-PR-UWYZ][A-HK-Y]?[0-9][ABEHMNPRVWXY0-9]? [0-9][ABD-HJLN-UW-Z]{2}
I checked this using Rubular and Expresso tools using the postcode "US6P 7AD" and both indicated this does not match the regex. Removing the space does produce a valid match.
The text was updated successfully, but these errors were encountered: