In fixtures, whenever I define a string as “yes”, it is stored as “t”
in the database.
Here is an example in YAML.
Now when I run the test, and check the test database (SQLite), I find
string “t” stored in place of “yes” for the column “is_active”.
Now consider following example (changed “yes” to “yup”) -
Now everything goes as expected and string “yup” is stored in database
for column “is_active”.
In my code, I use
User.is_active == "yes", to check that an user is
active. And any other value for is_active means user is inactive.
It took me almost four hours to identify why my tests are failing!
Later found that string “true” is also stored as “t” in database. and
“no” is stored as “f”.
I’m using -
Ruby 1.8.6 (patch 111)
Microsoft Winodws XP Home Edtn. SP2