Forum: Ruby on Rails Problem with RSpec in legacy databases

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2007-06-25 19:24
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

the fixture file (tbl_people.yml)
  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)

  it "" do
    @a_person.should be_valid


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.
This topic is locked and can not be replied to.