Created
May 28, 2013 23:01
-
-
Save farmdawgnation/5666802 to your computer and use it in GitHub Desktop.
Some of the specs for the Anchor Tab API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("GET /api/v1/embed/*") { | |
it("should return 200 and a jscmd for a valid tab id") { | |
runApiRequest("/api/v1/embed/" + validTab._id.toString, None, _.parameters = List("callback" -> "123")) { response => | |
response match { | |
case Full(JavaScriptResponse(jscmd, _, _, code)) => | |
code should equal (200) | |
case somethingUnexpected => fail(somethingUnexpected.toString) | |
} | |
} | |
} | |
it("should return a 404 and error for an invalid tab id") { | |
runApiRequest("/api/v1/embed/BACON", None, _.parameters = List("callback" -> "123")) { response => | |
response match { | |
case Full(InMemoryResponse(data, _, _, code)) => | |
code should equal (404) | |
(new String(data)) should equal ("Unknown tab.") | |
case somethingUnexpected => fail(somethingUnexpected.toString) | |
} | |
} | |
} | |
it("should return a 403 and error if the tab has been disabled") { | |
runApiRequest("/api/v1/embed/" + disabledTab._id.toString, None, _.parameters = List("callback" -> "123")) { response => | |
response match { | |
case Full(InMemoryResponse(data, _, _, code)) => | |
code should equal (403) | |
(new String(data)) should equal ("This tab has been disabled.") | |
case somethingUnexpected => fail(somethingUnexpected.toString) | |
} | |
} | |
} | |
it("should return a 400 and error if the callback parameter wasn't specified") { | |
runApiRequest("/api/v1/embed/" + validTab._id.toString, None) { response => | |
response match { | |
case Full(InMemoryResponse(data, _, _, code)) => | |
code should equal (400) | |
(new String(data)) should equal ("Callback not specified.") | |
case somethingUnexpected => fail(somethingUnexpected.toString) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment