# What is proper way to load lookup/reference data into test database?

**URL:** <https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675>\
**Category:** Rails\
**Created:** [June 5, 2008, 10:56pm UTC](https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675 "2008-06-05T22:56:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 5, 2008, 10:56pm UTC](https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675/1 "2008-06-05T22:56:05Z")

</div>

I’m just getting into writing tests for my first RoR app. I’ve got a  
few data migrations to load reference data (i.e. 2-char state abbrevs,  
payment types, etc.). How do I get that data into the test database?  
I understand fixtures are to load test data. But if I duplicate these  
lookup tables in test fixtures, it seems like that is violating the  
DRY principle. Is that OK in this case? Or do I run the data-only  
migrations into the test database somehow?

---

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 6, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675/2 "2008-06-06T15:00:11Z")

</div>

just bumping in the morning for an answer

---

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 6, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675/3 "2008-06-06T15:32:11Z")

</div>

I believe there is a rake command to load fixtures into test and other  
environments. However, I don’t know it. 😛

---

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 6, 2008, 4:02pm UTC](https://www.ruby-forum.com/t/what-is-proper-way-to-load-lookup-reference-data-into-test-database/139675/4 "2008-06-06T16:02:30Z")

</div>

I’ve only done a Unit Test so far, but I specified the fixtures to  
load in that test case. I also ran rake db:test:prepare command, but  
that only loaded the schema from dev, but not the data. I duplicated  
the data in my fixtures just to move forward, but I’m still wondering  
if that was the right thing to do.

The question was whether or not to duplicate the reference data in the  
fixture
