# Problem with RSpec in legacy databases

**URL:** <https://www.ruby-forum.com/t/problem-with-rspec-in-legacy-databases/107724>\
**Category:** Rails\
**Created:** [June 25, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/problem-with-rspec-in-legacy-databases/107724 "2007-06-25T19:24:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmcervera](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@jmcervera](https://www.ruby-forum.com/u/jmcervera)\
**Post date:** [June 25, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/problem-with-rspec-in-legacy-databases/107724/1 "2007-06-25T19:24:08Z")

</div>

Hello.  
I am a newbie with BDD.  
I am trying to use RSpec with some legacy tables and I use the  
set\_table\_name method in the models.  
The name of the table and the class doesnÂ´t match.  
It seems that there is no problem to load the fixture in Test::Unit, I  
will use the method set\_fixture\_class before loading fixtures, and I  
will get to the data in the fixture without problems.

But this doesnÂ´t seem to work in RSpec.

Anybody knows how to use it?

This is a sample of the code

## The model

class Person  
set\_table\_name = tbl\_people  
…  
end

## the fixture file (tbl\_people.yml)

one:  
id: 1  
name: John

## and the spec file (person\_spec.rb)

describe Person, “in general” do  
set\_fixture\_class :tbl\_people =\> Person  
fixtures :tbl\_people

before(:each) do  
@a\_person = tbl\_people(:one)  
end

it “” do  
@a\_person.should be\_valid  
end

end

Fixture data is loaded in the test database, I can get to it with a find  
method, but I canÂ´t get to it directly through the fixture method.
