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.