Prev | Current Page 319 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

This might save you quite a bit of time and energy if you already have your test
data stored in one of these types of applications.
Single File
Single-file fixtures are stored in a directory named after the model (or rather, in a directory
named after the database table). The directory should be located in the directory set by the
TestCase.fixture_path method (or in the create_fixtures method, as we described previously).
Each record is a separate file, and data within the file is presented in key => value
format. The files do not require an extension, but you may use the .txt extension if you like.
?– Note The single-file format has officially been deprecated in favor of the YAML and CSV formats, so we
don??™t recommend using it. Still, we??™ll cover the basic idea just in case you run into it while working with
legacy applications.
In the following example, we show two files that will equate to two records in our database.
The files in this example are located in C:\ruby\accounts:
# Test data record in Single File format saved as kevin.


Pages:
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331