Developers often take liberties when creating data in test files. It's true, the data doesn't matter.
Well, it doesn't matter to machines, but it does to humans.
Just because it's a test program doesn't mean that you should create nonsensical names. Having meaningful names makes it easier to understand the business logic.
Here's a snippet of code from a test file:
EmailLog.create_from_payload( to: [ 'email@example.com', 'firstname.lastname@example.org'], from: ['email@example.com'])
I am not sure what
qwe2 are supposed to mean here. It would be much better if the names were like the ones given below:
EmailLog.create_from_payload( to: [ 'firstname.lastname@example.org', 'email@example.com'], from: ['firstname.lastname@example.org'])
def test_email_is_normalized user = User.create! email: ' strAngeEmail@example.com' assert_equal 'email@example.com', user.email end
In the above case, it is not clear why the email is strange. A better name would help.
def test_email_is_normalized user = User.create! email: ' thisIsAMixedCaseEmail@example.com' assert_equal 'firstname.lastname@example.org', user.email end