Skip to content
jejacks0n edited this page Feb 16, 2014 · 7 revisions

By default Teaspoon uses Jasmine. You shouldn't have to do anything at all to get your specs running / passing using Jasmine.

Congratulations, you're done. Now go write some specs.

Example Spec

//= require jquery
describe("My great feature", function() {

  it("will change the world", function() {
    expect(true).toBe(true);
    expect(jQuery).toBeDefined();
  });

});

Example Fixture Usage

//= require jquery
fixture.preload("fixture.html", "fixture.json"); // make the actual requests for the files

describe("Using fixtures", function() {
  fixture.set("<h2>Another Title</h2>"); // create some markup manually (will be in a beforeEach)

  beforeEach(function() {
    this.fixtures = fixture.load("fixture.html", "fixture.json", true); // append these fixtures which were already cached
  });

  it("loads fixtures", function() {
    expect($("h1", fixture.el).text()).toBe("Title"); // using fixture.el as a jquery scope
    expect($("h2", fixture.el).text()).toBe("Another Title");
    expect(this.fixtures[0]).toBe(fixture.el); // the element is available as a return value and through fixture.el
    expect(this.fixtures[1]).toEqual(fixture.json[0]); // the json for json fixtures is returned, and available in fixture.json
  });
});