Specifying a binary field in test fixtures


#1

One of my fields holds binary data (a serialized object), and I’d like
to be able to create fixtures that have this data. I can just use erb
to build the object, but I don’t know how to write the fixture file
such that the object is serialized. Anyone know how to do this?


#2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 12, 2005, at 6:46 AM, Pat M. wrote:

One of my fields holds binary data (a serialized object), and I’d like
to be able to create fixtures that have this data. I can just use erb
to build the object, but I don’t know how to write the fixture file
such that the object is serialized. Anyone know how to do this?

YAML supports Base64-encoded binary values
http://yaml.org/type/binary.html

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDnY5LAQHALep9HFYRAoA1AJ0QjxLKuxqvPBAnldlNam5jdKfy1QCcD5Rz
vGIZ0S0QL/9bSFxSVtNPSb8=
=4xtR
-----END PGP SIGNATURE-----


#3

How do I specify this in the YAML file? And then when I’m accessing
the object, how do I ensure that it’s an object of the type I want,
not just a string stored in the db?

Pat