2013-02-20 13:15:50 -05:00
|
|
|
/*global waitsFor:true expect:true describe:true beforeEach:true it:true spyOn:true */
|
2013-02-27 21:26:20 -05:00
|
|
|
|
|
|
|
describe("Discourse.Onebox", function() {
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
spyOn(jQuery, 'ajax').andCallThrough();
|
2013-02-20 13:15:50 -05:00
|
|
|
});
|
|
|
|
|
2013-02-27 21:26:20 -05:00
|
|
|
it("Stops rapid calls with cache true", function() {
|
|
|
|
Discourse.Onebox.lookup('http://bla.com', true, function(c) { return c; });
|
|
|
|
Discourse.Onebox.lookup('http://bla.com', true, function(c) { return c; });
|
|
|
|
expect(jQuery.ajax.calls.length).toBe(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Stops rapid calls with cache false", function() {
|
|
|
|
Discourse.Onebox.lookup('http://bla.com/a', false, function(c) { return c; });
|
|
|
|
Discourse.Onebox.lookup('http://bla.com/a', false, function(c) { return c; });
|
|
|
|
expect(jQuery.ajax.calls.length).toBe(1);
|
|
|
|
});
|
2013-02-22 15:41:12 -05:00
|
|
|
|
2013-02-27 21:26:20 -05:00
|
|
|
});
|