Skip to content
This repository has been archived by the owner on Jul 22, 2018. It is now read-only.

Commit

Permalink
modified: Your-tests-are-lying-to-you.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Oakes committed Oct 1, 2011
1 parent 6f2433e commit 0db163b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Your-tests-are-lying-to-you.md
@@ -1,6 +1,14 @@
Tests
Synopsis
--------

> Mocks have an a bad rap lately. We've all seen brittle and unreadable test code riddled with 'should_receive' and 'mock_model', leading to classes people don't dare to touch. RSpec has now taken "mock_model" out of their default scaffolding for Rails controllers, and is preferring real objects. Does this mean that the concept of interaction testing is flawed?
>
> Well designed code is easy to test, and mocks enhance your sense of smell. State-based testing will lie to you and hide your bad code for longer, but your interaction tests explode if you don't keep your code clean and your object collaborators few. That's as it should be.
>
> Come to this talk if you want to hear a robust defence of mocks as a testing tool, see some examples of ruby code exhibiting the dangers of a reliance on state-based testing, and hear how you can use mocks to heighten your sense of smell, decrease coupling and increase cohesion.
Takeaways
---------

* Keep unit tests on their object, use mocks outside ("mockist")
* You still have to test integration
Expand Down

0 comments on commit 0db163b

Please sign in to comment.