Shane Mingins
2007-Nov-21 20:31 UTC
[rspec-users] When you sometimes wonder how to test this??
Hi Just something that I have been finding very helpful sometimes when I am stuck with "how could I test this?" moments is looking at the Rails test suite. At the moment I am working on testing our custom error_messages_for methods and I have found looking at how the Rails tests in active_record_helper work helpful :-) So just thought I''d share that. Have other''s done the same? Cheers Shane Shane Mingins ELC Technologies (TM) 1921 State Street Santa Barbara, CA 93101 Phone: +64 4 568 6684 Mobile: +64 21 435 586 Email: smingins at elctech.com AIM: ShaneMingins Skype: shane.mingins (866) 863-7365 Tel - Santa Barbara Office (866) 893-1902 Fax - Santa Barbara Office +44 020 7504 1346 Tel - London Office +44 020 7504 1347 Fax - London Office http://www.elctech.com -------------------------------------------------------------------- Privacy and Confidentiality Notice: The information contained in this electronic mail message is intended for the named recipient(s) only. It may contain privileged and confidential information. If you are not an intended recipient, you must not copy, forward, distribute or take any action in reliance on it. If you have received this electronic mail message in error, please notify the sender immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071122/28f38707/attachment-0001.html
Nathan Sutton
2007-Nov-21 20:43 UTC
[rspec-users] When you sometimes wonder how to test this??
One good idea is to add all your custom error messages to rails'' default hash so you can change the wording of it whenever you want and the key can remain the same. That way if you need to change it you don''t need to dive into your specs but can just change it in an initializer or environment. Nathan Sutton fowlduck at gmail.com rspec edge revision 2910 rspec_on_rails edge revision 2909 rails edge revision 8175 On Nov 21, 2007, at 2:31 PM, Shane Mingins wrote:> Hi > > Just something that I have been finding very helpful sometimes when > I am stuck with "how could I test this?" moments is looking at the > Rails test suite. > > At the moment I am working on testing our custom error_messages_for > methods and I have found looking at how the Rails tests in > active_record_helper work helpful :-) > > So just thought I''d share that. Have other''s done the same? > > Cheers > Shane > > Shane Mingins > ELC Technologies (TM) > 1921 State Street > Santa Barbara, CA 93101 > > > Phone: +64 4 568 6684 > Mobile: +64 21 435 586 > Email: smingins at elctech.com > AIM: ShaneMingins > Skype: shane.mingins > > (866) 863-7365 Tel - Santa Barbara Office > (866) 893-1902 Fax - Santa Barbara Office > > +44 020 7504 1346 Tel - London Office > +44 020 7504 1347 Fax - London Office > > http://www.elctech.com > > -------------------------------------------------------------------- > Privacy and Confidentiality Notice: > The information contained in this electronic mail message is > intended for the named recipient(s) only. It may contain privileged > and confidential information. If you are not an intended recipient, > you > must not copy, forward, distribute or take any action in reliance on > it. If you have received this electronic mail message in error, > please notify the sender immediately. > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071121/7dec1a62/attachment.html
David Chelimsky
2007-Nov-21 20:50 UTC
[rspec-users] When you sometimes wonder how to test this??
On Nov 21, 2007 2:43 PM, Nathan Sutton <nathan.sutton at gmail.com> wrote:> One good idea is to add all your custom error messages to rails'' default > hash so you can change the wording of it whenever you want and the key can > remain the same. That way if you need to change it you don''t need to dive > into your specs but can just change it in an initializer or environment.That''s how java frameworks like struts and spring work - you have a Resource Bundle, which is a fancy name for a hash stored in a file :) Also helps w/ i18n because you can just swap out files but use the same keys.> > > > > Nathan Sutton > fowlduck at gmail.com > rspec edge revision 2910 > rspec_on_rails edge revision 2909 > rails edge revision 8175 > > > > > > On Nov 21, 2007, at 2:31 PM, Shane Mingins wrote: > > > Hi > > Just something that I have been finding very helpful sometimes when I am > stuck with "how could I test this?" moments is looking at the Rails test > suite. > > At the moment I am working on testing our custom error_messages_for methods > and I have found looking at how the Rails tests in active_record_helper work > helpful :-) > > So just thought I''d share that. Have other''s done the same? > > Cheers > Shane > > > Shane Mingins > ELC Technologies (TM) > 1921 State Street > Santa Barbara, CA 93101 > > > Phone: +64 4 568 6684 > Mobile: +64 21 435 586 > Email: smingins at elctech.com > AIM: ShaneMingins > Skype: shane.mingins > > (866) 863-7365 Tel - Santa Barbara Office > (866) 893-1902 Fax - Santa Barbara Office > > +44 020 7504 1346 Tel - London Office > +44 020 7504 1347 Fax - London Office > > http://www.elctech.com > > -------------------------------------------------------------------- > Privacy and Confidentiality Notice: > The information contained in this electronic mail message is intended for > the named recipient(s) only. It may contain privileged and confidential > information. If you are not an intended recipient, you > must not copy, forward, distribute or take any action in reliance on it. If > you have received this electronic mail message in error, please notify the > sender immediately. > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >