I have a shopping application I am testing, and one of the models is an
Order model, within which a credit card number is encrypted and stored
in the db (mysql) as a BLOB field. When trying to run my unit tests, I
cannot get my model fixtures to load the encrypted data.
If, in my dynamic fixture (YAML) file, I could have access to my app’s
models, the problem would be trivial… instead of:
(which doesn’t work), I could insert:
payment_number: <%= Order.encrypt(“4111111111111111”) %>
which would give me what I want.
My question is one of two things: a) Is there any ruby code I can put in
the YAML file to “require” the Order model? Or, b) is there a way to get
the BLOB data out of the database and stick it in a fixture?