-
Notifications
You must be signed in to change notification settings - Fork 242
Using Mocha
jejacks0n edited this page Dec 24, 2012
·
19 revisions
Teabag makes it pretty easy to use Mocha for your tests, and includes some nice support libraries that you might find handy.
To get setup for Mocha just configure your suites to use Mocha instead of Jasmine. Here's an example of changing the default suite to use Mocha.
config/initializers/teabag.rb
Teabag.setup do |config|
config.suite do |suite|
config.javascripts = ["teabag/mocha", "expect", "sinon"]
end
end
You'll notice that we also included expect.js and sinon.js in here -- these are useful libraries that we like, but you're free to use others (like should.js). It's also worth noting that you could alternatively require expect.js
and sinon.js
from within your spec_helper -- which is advised, but to simplify this article we did it in one step.
You'll have to do this for all the suites you create where you want to use Mocha.