[rspec-users] Testing initialize methods and chained methods

David Chelimsky dchelimsky at gmail.com
Tue Oct 19 15:08:54 EDT 2010


On Oct 19, 2010, at 2:04 PM, Pat Maddox wrote:

> On Oct 19, 2010, at 12:56 AM, Oscar Del Ben wrote:
> 
>> I'm having some troubles understanding how to test a couple of things. Usually, if I'm having trouble testing something, it means that my design could probably be improved or changed, but in these cases I think I'm doing the right thing.
>> 
>> Here's the first scenario:
>> 
>> class Foo
>>  def initialize
>>    do_something
>>  end
>> end
>> 
>> Here I have no idea how to test that the do_something method is called.
> 
> What are the post-conditions of do_something?  Check for those.

Think "outcomes" as opposed to "post-conditions", which means something very specific (and subtly different) in the context of Design by Contract.


More information about the rspec-users mailing list