Displaying 9 results from an estimated 9 matches for "set_fixture_class".
2006 Mar 06
4
Change to set_fixture_class
So, I sat down to use set_fixture_class, and it bombed on the first
thing I tried:
set_fixture_class :content_drafts => "Article::Draft"
I made a quick patch, and I''d appreciate a quick run through your
tests to make sure it doesn''t disturb anything:
http://dev.rubyonrails.org/ticket/4095
As I was typin...
2006 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
...fixtures. I
believe the basic problem is the same as 3935
(http://dev.rubyonrails.org/ticket/3935) in that the accessor method
which is constructed by the fixture call can''t infer the class name
from the table name. The band-aid in 3935 was to allow you to define
the class in a table with set_fixture_class, but it won''t hold for
polymorphism.
We''re going to need to redesign the fixture accessors.
I''ll look at the code ASAP, but does anyone have suggestions on how to
go about it?
Kev
2007 Jan 14
2
rspec and set_table_name?
Hi there
I have a Value class in my Rails app; however ''values'' is a reserved
word in MySQL so in my value.rb file, I''ve declared set_table_name as
''vals''.
However, in setting up my specs for this model, I''m hitting errors
that seem to be resulting from rspec not seeing the set_table_name
declaration in my model file.
For instance,
2007 Jun 25
0
Problem with RSpec in legacy databases
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)
----...
2008 Jun 19
0
Error loading fixtures with classes that set_table_name
...;'m testing and I want to use fixtures. I''ve got
a fixtures file called "old_school.yml" that doesn''t load. Following
some googled advice
(http://www.missiondata.com/blog/uncategorized/80/rails-fixtures-with-models-using-set_table_name/)
I learned that I had to use set_fixture_class to be able to map the
fixture back to the class name:
# in test_helper.rb
class Test::Unit::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
set_fixture_class :old_school => School
fixtures :all
end
Seems like it ought to work, but the fixtures...
2008 Jun 23
0
Error loading fixtures for classes that set_table_name
...;'m testing and I want to use fixtures. I''ve got
a fixtures file called "old_school.yml" that doesn''t load. Following
some googled advice
(http://www.missiondata.com/blog/uncategorized/80/rails-fixtures-with-models-using-set_table_name/)
I learned that I had to use set_fixture_class to be able to map the
fixture back to the class name:
# in test_helper.rb
class Test::Unit::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
set_fixture_class :old_school => School
fixtures :all
end
Seems like it ought to work, but the fixtures...
2011 Aug 17
7
autoloading LoadError: Expected known_ip.rb to define KnownIp
...ass KnownIP defined in a file named "known_ip.rb"
(rather than "known_i_p.rb").
This file name was generated by the model generator, in i prefer it this
way.
In any case, the application works.
The database table is called "known_ips".
To my test_helper.rb i added
set_fixture_class :known_ips => KnownIP,
(otherwise it would guess "KnownIp").
Now, when it try to run Unit Tests, i get an error:
LoadError: Expected .../known_ip.rb to define KnownIp.
gems/activesupport-3.1.0.rc6/lib/active_support/dependencies.rb:486:in
`load_missing_constant''
I looked i...
2010 Dec 12
5
Fixtures and unit tests - no such file to load
...x it.
Background:
I have a table in my legacy database called tp_approval_step.
For this table I have a fixture called tp_approval_step.yml
I have a model called ApprovalProcessStep that uses set_table_name
''tp_approval_step''
In my test file, ApprovalProcessStepTest, I have used
set_fixture_class :tp_approval_step => ApprovalProcessStep
Now whenever I run rake test:units I get this error:
Unable to load tp_approval_step, underlying cause no such file to load
-- tp_approval_step
And not only do I get this for the example above, but I get it for
every fixture in my rails app.
Any help w...
2006 May 23
2
Putting fixtures into subdirectories
I want to organize my fixtures just like the namespace of my models. So
for example if I have a model Company::Employee I''d like the fixture to
be in fixtures/company/employees.yml.
However, I can''t figure out how to specify the path of the fixture file.
If I do:
fixtures :employees
in my unit test it can''t find the fixture file. Any suggestions?
Thanks,
Todd