views:

22

answers:

1

I currently have some large strings that I would like use as test data when testing a log scraper. It would work well to have these strings in a YAML file.

I would love to refer to them while testing in a short and concise manner such as:

log_lines(:incorrect_string)

Is there anyway to do this using fixtures, or are they exclusively for use with a corresponding model?

A: 

If your yaml looks like this:

:incorrect_string: blah

then you can just

logs = YAML::load_file('filename')
p logs[:incorrect_string]

cheer!

Chuck Vose
Thanks for that!
Cam