Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread Phlip
Brandon Olivares wrote: So is this necessarily bad? I've heard it's not always good to reduce duplication in tests, but it just seems much preferable than copy/paste. Refactor production code (while passing the tests after each edit) to make it as DRY as possible. This _typically_ means dupli

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread Brandon Olivares
@rubyforge.org] On Behalf Of David Chelimsky > >> Sent: Friday, April 10, 2009 3:10 AM > >> To: rspec-users > >> Subject: Re: [rspec-users] Eliminating duplication from tests > >> > >> Can you please post specific examples of the use of these so we &g

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread Phlip
Brandon Olivares wrote: Oh, and that described_class trick is great; thanks for showing me that. http://c2.com/cgi/wiki?AbstractTest ? ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread Brandon Olivares
Of David Chelimsky > >> Sent: Friday, April 10, 2009 3:10 AM > >> To: rspec-users > >> Subject: Re: [rspec-users] Eliminating duplication from tests > >> > >> Can you please post specific examples of the use of these so we > don't > >> hav

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread David Chelimsky
c-users >> Subject: Re: [rspec-users] Eliminating duplication from tests >> >> Can you please post specific examples of the use of these so we don't >> have to talk in generalities? > > Sure, here is something I just wrote. > >    def assert_route

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread Brandon Olivares
> -Original Message- > From: rspec-users-boun...@rubyforge.org [mailto:rspec-users- > boun...@rubyforge.org] On Behalf Of David Chelimsky > Sent: Friday, April 10, 2009 3:10 AM > To: rspec-users > Subject: Re: [rspec-users] Eliminating duplication from tests >

Re: [rspec-users] Eliminating duplication from tests

2009-04-10 Thread David Chelimsky
On Fri, Apr 10, 2009 at 1:14 AM, Brandon Olivares wrote: > Hi, > > Lately I've found myself trying to reduce typing as much as possible, so > when I have a lot of tests that only differ in a few variables, I tend to > abstract them to reduce typing. abstract or extract? I think you mean extract.

[rspec-users] Eliminating duplication from tests

2009-04-09 Thread Brandon Olivares
Hi, Lately I've found myself trying to reduce typing as much as possible, so when I have a lot of tests that only differ in a few variables, I tend to abstract them to reduce typing. For instance, I have an assert_form_errors method that I call within a describe block to ensure the proper errors