Reputation: 4290
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?
Upvotes: 3
Views: 215
Reputation: 17353
Both expects and stubs prevent execution of the specified method. The difference is that expects creates an assertion that causes the test to fail if the method isn't called, and stubs doesn't create any assertion.
Upvotes: 0
Reputation: 2262
Never used mocha, but this is indeed the case for all mocking frameworks i've worked with
Upvotes: 1