[Rspec-users] Mocking causes empty specification blocks
aslak hellesoy
aslak.hellesoy at gmail.com
Mon Jul 24 13:40:14 EDT 2006
On 7/24/06, Chris Roos <chrisjroos at gmail.com> wrote:
> I've found myself mocking out a published api in my set-up method.
What do you mean by mocking a published API. Are you setting up
expectations for all of the API's methods?
> This has led to some contexts having a large set-up and empty
> specifications. As the mocks get auto-verified, the specification
> blocks have nothing to do but serve as documentation. Does this sound
> bad?
>
I'm not sure you're using mocks the way they are inteded to be used.
The purpose of a mock is to verify that a certain conversation (i.e.
message passing) takes place between two objects. You should only mock
the methods that you expect to be invoked in a certain situation.
Don't set up expectations for all methods in your mocked API.
Aslak
> Chris
> _______________________________________________
> Rspec-users mailing list
> Rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
More information about the Rspec-users
mailing list