# Help wrtiting test for models that use CSV data

**URL:** <https://www.ruby-forum.com/t/help-wrtiting-test-for-models-that-use-csv-data/114695>\
**Category:** Rails\
**Created:** [September 17, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/help-wrtiting-test-for-models-that-use-csv-data/114695 "2007-09-17T13:24:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonypm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a587f6/32.png) [@tonypm](https://www.ruby-forum.com/u/tonypm)\
**Post date:** [September 17, 2007, 1:24pm UTC](https://www.ruby-forum.com/t/help-wrtiting-test-for-models-that-use-csv-data/114695/1 "2007-09-17T13:24:19Z")

</div>

Hi, could use some help with this.

I have an app that imports CSV data (which it receives from another  
app as an automated entry to a data field on a form)

I want to write test for the models that use this data. I have one  
model with no database that takes the CSV record and makes it an  
object that I can work with.

Then that object gets split into Customer, Order and LineItem models.

This means that I need CSV raw data to build the tests around. My  
main question is where do I put this data and how do I store it. I  
could build some test strings, or I could use test files, but it would  
be nice to make them accessible to different model tests.

I am still green at writing tests and cant get my head around how best  
to go about this.

Any ideas??

Thanks  
Tonypm
