[rspec-users] specs on private methods

Matt Patterson matt-lists at reprocessed.org
Tue Jan 8 14:06:00 EST 2008


On 8 Jan 2008, at 18:39, Chris Olsen wrote:

> How does a person test private methods?
>
> Is there a way to declare them as private, but retain any tests that
> were written during the initial development?

I'm rather liking Jay Field's approach (described at http:// 
blog.jayfields.com/2007/11/ruby-testing-private-methods.html)

In which he basically redeclares the private methods public for the  
duration of the test only, with a bit of block-scoped evaling goodness.

Matt

-- 
   Matt Patterson | Design & Code
   <matt at reprocessed org> | http://www.reprocessed.org/




More information about the rspec-users mailing list