Might be a personal thing, but my approach is that I try to test the public behaviour of the object. Testing private methods is, imho, getting dangerously close to specifying how the object does its business, rather than what it does.
I would just spec the externally visible behaviour, where it occurs, and let the object implement it as it wants (using private methods or any other mechanism). Daniel On 8 Jan 2008, at 19:06 8 Jan 2008, Matt Patterson wrote: > 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/ > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users