[rspec-users] alias method spec?

Bryan Helmkamp bhelmkamp at gmail.com
Tue Mar 20 12:52:55 EDT 2007

On 3/20/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> On 3/20/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> >
> > Well honestly I just wanted a method which could be called in the
> > plural or singular, something like:
> >
> > column_name :a_col
> >
> > or
> >
> > columns_names :a_first_col, :a_second_col
> >
> > but I want it to be the same method, and I want it to work the same
> > way.  (namely to return an array or a hash, and/or possibly set an
> > instance variable)
> >
> > That's what led me to the idea in the first place, that I should test
> > them in separate contexts, but assuring that they were indeed the
> > same method in one of the contexts...
> What benefit is there to knowing they are the same method, as long as
> they both do the same thing?

I've experienced a similar situation before. The reason I looked at
testing that they are the same method is that it seemed more DRY to do
that than to copy/paste the specs for that method and replace the
name. WDYT?


More information about the rspec-users mailing list