# Unit tests, Fixtures, Authority Data, Oh my!

**URL:** <https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213>\
**Category:** Rails\
**Created:** [December 28, 2005, 5:20am UTC](https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213 "2005-12-28T05:20:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 28, 2005, 5:20am UTC](https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213/1 "2005-12-28T05:20:29Z")

</div>

Yo guys…

I’m starting to get into testing my current e-commerce Rails app before  
I  
Engine-ify it…(Codename “Substruct” - don’t sleep!)

I’ve got some data that should be loaded before each test. Convention  
tells  
me that I should prepare this data in nice YML files as fixtures,  
although  
I’m not quite so sure.

The data in question is a country list (upwards of 200 items), order  
status  
codes, and shipping codes (fedex, ups, dhl, etc) amongst other things.  
All  
standard stuff that’s needed in tests and in the real production app.

I have all of the default values in a SQL file that I load for new  
applications with a Rake task. I really don’t want to duplicate that  
information in fixtures - especially the huge country list.

I’ve been calling that Rake task in the “setup” method - which works  
sometimes. On OSX/Linux it works, in XP it breaks. I’m guessing XP  
doesn’t  
like `rake load_authority_data`. Ideas on that? Additionally, running  
the  
rake task in setup causes my tests to run extremely sloooow.

How is everyone handling this situation in their applications? How do  
you  
load authority data in new applications vs testing? Am I doing something  
really stupid here or what?

Let me know, thanks…

---

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 28, 2005, 7:16am UTC](https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213/2 "2005-12-28T07:16:13Z")

</div>

Check this out:  
[http://nubyonrails.com/articles/2005/12/27/dump-or-slurp-yaml-reference-data](http://nubyonrails.com/articles/2005/12/27/dump-or-slurp-yaml-reference-data)

That should do it.

---

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 28, 2005, 8:48am UTC](https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213/3 "2005-12-28T08:48:06Z")

</div>

Are you suggesting I just use that tool and keep all of my regular data  
in  
fixtures instead of SQL?

---

<div class="post-metadata">

**Author:** ![subimage\_interactiv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c37758/32.png) [@subimage\_interactiv](https://www.ruby-forum.com/u/subimage_interactiv)\
**Post date:** [December 28, 2005, 5:12pm UTC](https://www.ruby-forum.com/t/unit-tests-fixtures-authority-data-oh-my/51213/4 "2005-12-28T17:12:55Z")

</div>

subimage interactive wrote:

> Are you suggesting I just use that tool and keep all of my regular data  
> in  
> fixtures instead of SQL?

Maybe not all of it but if you already have those countries in SQL then  
youcan just dump them to fixtures this way…
