Guo Yangguang
2010-Dec-04 16:33 UTC
test a non active_record class in models directory in rails 3?
hi i have a non active_record class in models dir which is like following: class BuildSurvey end i want to test this class,so manually defined a test file which is like following require ''test_helper'' require ''build_survey'' class BuildSurveyTest < ActiveSupport::TestCase end but when i ran test,i got error like this: undefined method ''<'' nil:NilClass i want to know how to test a non active_record class in models directory in rails 3.can you help me? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2010-Dec-04 17:30 UTC
Re: test a non active_record class in models directory in rails 3?
On Dec 4, 4:33 pm, Guo Yangguang <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> hi > i have a non active_record class in models dir which is like following: > > class BuildSurvey > > end > > i want to test this class,so manually defined a test file which is like > following > > require ''test_helper'' > require ''build_survey'' > class BuildSurveyTest < ActiveSupport::TestCase > > end > > but when i ran test,i got error like this: > > undefined method ''<'' nil:NilClass > > i want to know how to test a non active_record class in models directory > in rails 3.can you help me?You don''t have to do anything beyond what you''ve shown (the require build_survey is unnecessary) You''re going to have to show a little more (eg what does the backtrace for that error look like?) Fred> > -- > Posted viahttp://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Guo Yangguang
2010-Dec-05 03:00 UTC
Re: test a non active_record class in models directory in rails 3?
Frederick Cheung wrote in post #966198:> On Dec 4, 4:33pm, Guo Yangguang <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> require ''test_helper'' >> in rails 3.can you help me? > You don''t have to do anything beyond what you''ve shown (the require > build_survey is unnecessary) > You''re going to have to show a little more (eg what does the > backtrace for that error look like?) > > Fredhi Fred,you are right,i made a mistake when converting a str to date.Thank you. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.