tag:blogger.com,1999:blog-12467669.post8188337084900864074..comments2023-04-29T07:23:25.825-04:00Comments on Jay Fields' Thoughts: Rails: Unit Test without RailsJayhttp://www.blogger.com/profile/14491442812573747680noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-12467669.post-4709652851878568822008-04-13T18:33:00.000-04:002008-04-13T18:33:00.000-04:00Could you give me a hint, how you test association...Could you give me a hint, how you test associations like has_many in a unit test. In particular if the tested behaviour depends the 'master'.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-51568758789783514662007-12-13T22:30:00.000-05:002007-12-13T22:30:00.000-05:00Phil,That's fantastic. If you send me a patch I'll...Phil,<BR/><BR/>That's fantastic. If you send me a patch I'll be glad to update the library and add you as a contributor.<BR/><BR/>Cheers, JayAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-68514693479608518082007-12-13T19:53:00.000-05:002007-12-13T19:53:00.000-05:00Managed to get it working by stubbing quite a few...Managed to get it working by stubbing quite a few more AR class methods (such before_save. mmm) and with this code added just after the arbs require it works with Rails 2!<BR/><BR/>class BehaviorAppender<BR/> def method_missing(type, method, *arguments, &block)<BR/> column(method, type, arguments)<BR/> end<BR/>end<BR/><BR/>Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-53643142527425790112007-12-13T15:05:00.000-05:002007-12-13T15:05:00.000-05:00On Windows startup time is horrendous so this woul...On Windows startup time is horrendous so this would really help. However Rails 2 generates columns like <BR/>t.date "created_on"<BR/>and so it chokes on the new syntax for defining columns.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-18386985374300698252007-10-28T12:28:00.000-04:002007-10-28T12:28:00.000-04:00Nope, I've given up on unit testing controllers. I...Nope, I've given up on unit testing controllers. I stick to functional testing them for the time being.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12467669.post-91411345971600729082007-10-27T15:55:00.000-04:002007-10-27T15:55:00.000-04:00Interesting approach... Have you done something si...Interesting approach... Have you done something similar for when testing your controllers?Ben Mabeyhttps://www.blogger.com/profile/08152995778702798400noreply@blogger.com