I used faker to dump data. But i don't want special character in faker data. Sometimes Faker::Name.first_name return data with single quotes.
Example :
Faker::Name.first_name -> "O'Hara"
@elangovan91 Here data is coming from here
And if you don't want special characters to be present in name I think this name should be removed from fake data but that is valid name and currently I didn't find option to reject such names.
Sometimes having special characters in test data can make your code more robust if it can deal with those. I would argue there aren't enough special characters
Maybe use something like
Faker::Name.first_name.gsub(/\W/, '')
since it's returning a string
Thank You guys for your suggestion. @Jack-Barry I used your concept.
In case of filename, I replaced the special character with alternative character using this: randomFileName = getFaker().file().fileName().replace("\",randomFileNameDelimiter);
It seems really odd, that I have to add this...
first_name { Faker::Name.last_name.gsub(/\W/, '').gsub("\u0000", '') }
last_name { Faker::Name.last_name.gsub(/\W/, '').gsub("\u0000", '') }
to guarantee these work correctly.
Most helpful comment
Maybe use something like
since it's returning a string