On Apr 6, 2009, at 12:45 AM, Ps_gem Sh_gem wrote:
> > Hi, I am new in ROR. I have 4 fixtures in my '../test/fixtures' > folder: > user.yml, aggregationfeedmaps.yml, aggregations.yml, and feeds.yml. I > have few test files in unit tests folder like user_test.rb, > feeds_test.rb, aggregation_test.rb and such. > > When I wrote test for model 'user' using fixture user.yml it worked > fine. But when I tried to run test for my other models using fixtures > aggregationfeedmaps.yml, aggregations.yml, and feeds.yml it shows this > error: > > FixtureClassNotFound: No class attached to find > > my test file 'feeds_test.rb': You're probably running into a naming issue. Models are expected to be the singular name and the tables will be plural as will the fixture files. You can see them all with the Pluralizer http://nubyonrails.com/tools/pluralize But here's a simple listing: test/fixtures/feeds.yml app/model/feed.rb class Feed < ActiveRecord::Base in a database tables named "feeds" It also expects to convert between CamelCase and under_scored so if your model is AggregationFeedMap, the file defining it should be app/ models/aggregation_feed_map.rb and the table name should be aggregation_feed_maps and the fixture found in test/fixtures/ aggregation_feed_maps.yml Does this help you figure out your issues? It all becomes quite natural after a short while, but there are still times where you'll have a model name that the Inflector doesn't get the pluralization right and you either have to adjust or define an extra rule for the word you want to use. -Rob Rob Biedenharn http://agileconsultingllc.com [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

