Skip to content

Commit

Permalink
Merge pull request #76 from astorije/patch-1
Browse files Browse the repository at this point in the history
Update the guide to mention the showDiff argument of assert
  • Loading branch information
keithamus committed Mar 1, 2015
2 parents c4546c4 + b79ed48 commit 268d386
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion data/guide/plugins/assert.md
Expand Up @@ -32,13 +32,15 @@ the assertion failed and the first error message will be thrown as part of a `ch
Conversely, if the language chain was negated, it will consider `false` a pass and `true` a failure.
The second error message will be included in the thrown error instead.

In all, the `assert` method accepts five arguments:
In all, the `assert` method accepts six arguments:

1. a boolean (result of a truth test)
2. a string error message to be used if the first argument is `false`
3. a string error message to be used if the assertion is negated and the first argument is `true`
4. (optional) the expected value
5. (optional) the actual value, which will default to `_obj`
6. (optional) a boolean which indicates whether to display a diff in addition to the message if the first argument is `false`


### Composing Error Messages

Expand Down
5 changes: 3 additions & 2 deletions out/guide/plugins/index.html
Expand Up @@ -173,13 +173,14 @@ <h3 id="basic-assertion">Basic Assertion</h3>
the assertion failed and the first error message will be thrown as part of a <code>chai.AssertionError</code>.
Conversely, if the language chain was negated, it will consider <code>false</code> a pass and <code>true</code> a failure.
The second error message will be included in the thrown error instead.</p>
<p>In all, the <code>assert</code> method accepts five arguments:</p>
<p>In all, the <code>assert</code> method accepts six arguments:</p>
<ol>
<li>a boolean (result of a truth test)</li>
<li>a string error message to be used if the first argument is <code>false</code></li>
<li>a string error message to be used if the assertion is negated and the first argument is <code>true</code></li>
<li>(optional) the expected value</li>
<li>(optional) the actual value, which will default to <code>_obj</code></li>
<li>(optional) a boolean which indicates whether to display a diff in addition to the message if the first argument is <code>false</code></li>
</ol>
<h3 id="composing-error-messages">Composing Error Messages</h3>
<p>As you can see from the above example, Chai can accept template tags to dynamically compose
Expand Down Expand Up @@ -232,4 +233,4 @@ <h3 class="fancy"><a href="#">Chai Assertion Library</a></h3>
</section>
</footer>
</body>
</html>
</html>

0 comments on commit 268d386

Please sign in to comment.