views:

55

answers:

1

Hi I'm using Mocha for a Rails project. I'm new to TDD so please forgive me if this is a stupid question.

If I have this

@client.expects(:create_config).once.returns(true)

then am I right in assuming that the code in create_config() won't be run and instead true will just be returned?

+1  A: 

Never used mocha, but this is indeed the case for all mocking frameworks i've worked with

Mel Gerats
Never used mocha, but that behavior is kind of the entire *point* of mock objects...
kyoryu
I wasnt sure if mocks just asserted whether or not a certain method was called or not or if they also bypassed the actual methods code as well. I knew stubs existed to do the latter so thought perhaps mocks didnt do that.
adam