The second test, saying that an h3 element exists, should clearly fail, but doesn't. What's going on?
Using Mocha, Chai, Ember, and ember-mocha-adapter, I created this simple example: http://jsfiddle.net/signer247/UD2D3/4/.
HTML
<div id="mocha"></div>
<hr/>
<div id="ember-testing"></div>
<script type="text/x-handlebars" data-template-name="application">
<h1>Ember.js Testing with Ember Mocha Adapter</h1>
</script>
CoffeeScript
App = Em.Application.create()
App.Router.map ->
@route 'index', path: '/'
App.rootElement = '#ember-testing';
App.setupForTesting()
App.injectTestHelpers()
Ember.Test.adapter = Ember.Test.MochaAdapter.create()
chai.should()
describe 'Changing a site via visit in the test with andThen helper', ->
beforeEach ->
App.reset()
visit('/')
it 'should work', ->
andThen ->
$c = $(App.rootElement)
$c.find('h1').should.exist
it 'should fail', ->
andThen ->
$c = $(App.rootElement)
$c.find('h3').should.exist
$(document).ready ->
mocha.run();
My JSFiddle: http://jsfiddle.net/signer247/UD2D3/4/
I built my JSFiddle off of this example: http://jsfiddle.net/UD2D3/1/
This is the ember-mocha-adapter: https://github.com/teddyzeenny/ember-mocha-adapter