# unit tests and fixtures

**URL:** <https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128>\
**Category:** rubyonrails-talk\
**Created:** [August 13, 2009, 3:14pm UTC](https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128 "2009-08-13T15:14:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [August 13, 2009, 3:14pm UTC](https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128/1 "2009-08-13T15:14:26Z")

</div>

Hello

I'm experiencing some problems using rails fixtures with unit tests.

With my version of Ruby I have to define test with the following syntax:

test 'some test' do &nbsp;&nbsp;assert.. end

instead of

def test\_some\_test &nbsp;&nbsp;assert.. end

If I try to include/load the fixtures by using: &nbsp;&nbsp;fixtures :stories, :votes

after the class definition, I get the following errors:

StandardError: No fixture with name..

What am I doing wrong? Is this the latest Ruby test code or am I using some outdated version? Is there any place that I could check that (I tried with some googling without relevant results)?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [August 13, 2009, 10:06pm UTC](https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128/2 "2009-08-13T22:06:22Z")

</div>

> Hello
> 
> I'm experiencing some problems using rails fixtures with unit tests.
> 
> With my version of Ruby I have to define test with the following syntax:
> 
> test 'some test' do assert.. end
> 
> instead of
> 
> def test\_some\_test assert.. end

Either syntax works.

> If I try to include/load the fixtures by using: fixtures :stories, :votes

you don't need that any more - The default test\_helper.rb is set to load all fixtures.

Fred

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [August 14, 2009, 3:05pm UTC](https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128/3 "2009-08-14T15:05:11Z")

</div>

Have you got a record 'first:' in stories.yml? If so check the syntax carefully.

Colin

---

<div class="post-metadata">

**Author:** ![F\_fireflyman](https://avatars.discourse-cdn.com/v4/letter/f/ebca7d/32.png) [@F\_fireflyman](https://discuss.rubyonrails.org/u/F_fireflyman)\
**Post date:** [August 17, 2009, 2:15am UTC](https://discuss.rubyonrails.org/t/unit-tests-and-fixtures/45128/4 "2009-08-17T02:15:57Z")

</div>

You should write fixtures :stories, :votes, :first
