p_W wrote: > I have been developing with RoR for a little but haven't really dived > too much into the testing framework yet ( I know, sacrilege!) . I was > wondering about the best way to test a has_many relationship. Let's > say I have an album that contains many photos. The album model > has_many :photos while the photo model belongs_to :album. I have the > album unit test working but was interested in a way to test that the > relationship will work how I want it to.
ActiveRecord is well tested. Focus on testing your app code instead. (reflect_on_association is handy for testing that you've specified your associations properly.) > Should I put that code in > the album unit test? I tend to put my association specs in the class unit spec (I use RSpec, not Test::Unit), since associations are a property of the model. I'd usually test each end of the association in the respective model's spec file. > In the functional test? Forget those things and go straight to Cucumber. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

