stop onebox rapid fire

This commit is contained in:
Sam Saffron
2013-02-19 10:33:07 +11:00
parent 82132ab48b
commit 3be7bde401
2 changed files with 27 additions and 4 deletions

View File

@ -0,0 +1,14 @@
describe "Discourse.Onebox", ->
beforeEach ->
spyOn($, 'ajax').andCallThrough()
it "Stops rapid calls with cache true", ->
Discourse.Onebox.lookup('http://bla.com', true, (c) -> c)
Discourse.Onebox.lookup('http://bla.com', true, (c) -> c)
expect($.ajax.calls.length).toBe(1)
it "Stops rapid calls with cache false", ->
Discourse.Onebox.lookup('http://bla.com/a', false, (c) -> c)
Discourse.Onebox.lookup('http://bla.com/a', false, (c) -> c)
expect($.ajax.calls.length).toBe(1)