[rspec-users] validate_presence_of

Mark Wilden mark at mwilden.com
Thu Feb 19 12:38:09 EST 2009

On Wed, Feb 18, 2009 at 9:40 PM, Stephen Eley <sfeley at gmail.com> wrote:
> On Wed, Feb 18, 2009 at 11:42 PM, Yi Wen <hayafirst at gmail.com> wrote:
> validates_presence_of happens to be the name of the method in
> ActiveRecord that does that.  But if you decide to write your own
> check_to_see_if_this_thingy_is_in_my_whatsis() method that does the
> same thing, a good *behavior* spec will not break.  Because the
> behavior remains the same.

I think you're talking about state-based, blackbox testing, rather
than behavior-based whitebox testing. RSpec unit tests are all about
speccing that one object calls another object's method at the right
time. The idea being that if that behavior occurs, and that the other
object's method has been similarly tested, that you're OK.


More information about the rspec-users mailing list