Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Better JavaScript with Jasmine

Better JavaScript with Jasmine

Quick introduction into the Jasmine testing framework for JavaScript, geared towards the rubyist.

Todd Kaufman

July 27, 2012
Tweet

More Decks by Todd Kaufman

Other Decks in Technology

Transcript

  1. I have [ ] more [ ] less JavaScript in

    my code than I used to.
  2. I have [ X ] more [ ] less JavaScript

    in my code than I used to.
  3. describe RomanNumeral do it "should convert I to 1" do

    subject = RomanNumeral.new("I") subject.to_i.should eq(1) end end
  4. describe("RomanNumeral", function() { it("returns 1 for I", function() { var

    subject = new RomanNumeral("I"); return expect(subject.toI()).toBe(1); }); });
  5. RSpec Jasmine describe User do describe(“User”, function() it “saves stuff”

    do it (“saves stuff”, function() value.should expect(value)
  6. describe("RomanNumeral", function() { it("returns 1 for I", function() { var

    subject = new RomanNumeral("I"); return expect(subject.toI()).toBe(1); }); });
  7. describe "RomanNumeral", -> it "returns 1 for I", -> subject

    = new RomanNumeral("I") expect(subject.toI()).toBe 1