[rspec-users] State Based vs. Behaviour Based Spec/Testing
pergesu at gmail.com
Sun Mar 25 02:40:58 EDT 2007
On 3/25/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> On Mar 25, 2007, at 2:25 AM, Pat Maddox wrote:
> > On 3/24/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
> >> 1. Should you test protected and private methods in your specs?
> > No. You're specifying the behavior of an object as seen by the
> > outside world. Of course protected and private methods aren't
> > available to the world, so why would you need to test them? When
> > you're doing state-based testing, just call a method and then verify
> > that it returns the expected value or leaves your object in an
> > expected state.
> How about if your writing code that is *only* meant to be reused?
> E.g., you are writing some class which is only meant to be derived
> from (ruby metaprogramming - Spec'ing rails would be a good example)?
> rspec-users mailing list
> rspec-users at rubyforge.org
I'm not sure what you mean, to tell you the truth. Would you mind
showing an example of some code that you want to spec but aren't sure
More information about the rspec-users