So I'm building an angular project... And I have a class called "entries" with child classes like "twitter entries", "Facebook entries", etc.
Ideally I'd like to write one spec, and run all of the children classes through the specs. I haven't figured out how to do that.
Any suggestions on how to function-ize a jasmine spec?
I'd write a standard JS function that runs the Jasmine expectations, and pass each child class in via a separate spec. Something like:
describe("my multi-class spec suite", function(){
//common specs for each child class
var myExpectations = function(childClass) {
expect(childClass).toBeDefined();
expect(childClass.inheritedMethod()).toEqual("some common value");
...
};
//pass in your children classes
it('should have twitter entries that behave', function(){
myExpectations(new TwitterEntry());
});
it('should have facebook entries that behave', function(){
myExpectations(new FacebookEntry());
});
});