Some of my ror test cases are passing individually when run using the ruby command. But when I run on rake, they fail. This is happening specifically on db2. I need some help on the same.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Okay, I found the answer after some digging.
The problem was that I was trying to assert the results of a find on a model object.
Now internally, this find translates into a select query on the database.
Unfortunately, oracle/db2 do not guarantee the order of the select fetch.
In many test cases, I was asserting the first/second/third etc element of the array returned by the find statement. The problem here is, the index of zero of the array might contain a different value as the select might return in a different order.
So either, use a order by clause or sort the resultant array and then assert.
I still have some failures on db2, but then, the number has drastically come down.
Cheers!