Reduce duplication

Some would also say it'd be a good idea not to put random stuff in the
global namespace. One day I'll figure it out.
This commit is contained in:
Vit Brunner
2013-06-11 08:59:31 +01:00
parent 9a4fce961b
commit ff0bd79c53
4 changed files with 9 additions and 10 deletions
@@ -0,0 +1,6 @@
this.testReader = (name, testCases) ->
injector = angular.injector(["ng", "sideBySide"])
reader = injector.get(name)
for testCase in testCases
deepEqual(reader(testCase.tested), testCase.expected)
+1 -5
View File
@@ -1,7 +1,4 @@
test("jsonReader", () ->
injector = angular.injector(["ng", "sideBySide"])
jsonReader = injector.get("jsonReader")
testCases = [{
tested: """
{
@@ -28,6 +25,5 @@ test("jsonReader", () ->
}
}]
for testCase in testCases
deepEqual(jsonReader(testCase.tested), testCase.expected)
testReader("jsonReader", testCases)
)
+1 -5
View File
@@ -1,7 +1,4 @@
test("markdownReader", () ->
injector = angular.injector(["ng", "sideBySide"])
markdownReader = injector.get("markdownReader")
testCases = [{
tested: """
Title: Universal Declaration of Human Rights
@@ -73,6 +70,5 @@ test("markdownReader", () ->
}
}]
for testCase in testCases
deepEqual(markdownReader(testCase.tested), testCase.expected)
testReader("markdownReader", testCases)
)