15 Jun '13, 11am

"What have you written to make unit-testing Javascript easier?"

August 31, 2011 jdclayton javascript testing Jasmine Underscore.js shared example groups Jasmine and Shared Examples I’ve been doing a bit more Javascript development as of late and am using Jasmine for my unit tests. It’s been wonderful. I did find that it was a bit of a bear to test shared behavior (there’s a couple levels of inheritance in the Backbone models) so I decided to whip up a crude implementation of shared behavior. appNamespace.jasmine.sharedExamples = { "rectangle": function() { it("has four sides", function() { expect(this.subject.sides).toEqual(4); }); }, "square": function() { it("has the same width and height", function() { expect(this.subject.width).toEqual(this.subject.height); }); }, "an object with area": function(options) { it("calculates area correctly", function() { expect(this.subject.area()).toEqual(options.area); }); } }; I’ve declared a handfu...

Full article: http://robots.thoughtbot.com/post/9611103221/jasmine-and-...

Tweets

Creating Magic Through Shared Value

Creating Magic Through Shared Value

triplepundit.com 13 Jun '13, 9am

Historically, companies interacted with society through philanthropy. What started as simple donations to good causes evol...