Created
December 3, 2014 13:19
-
-
Save edysegura/ba3b5f90c17d06e705a7 to your computer and use it in GitHub Desktop.
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
def "Should return the number of events for each month of all events"() { | |
given: | |
controller.eventService = Mock(EventService) { | |
historyReport() >> [ | |
"2012": ["eventCount" : 6, "monthlyCount" : ["December" : 4, "November" : 1, "January" : 1]], | |
"2011": ["eventCount" : 3, "monthlyCount" : ["October" : 3]] | |
] | |
} | |
when: | |
controller.history() | |
then: | |
def result = JSON.parse(mockResponse.contentAsString) | |
result.size() == 2 | |
result."2012" == ["eventCount" : 6, "monthlyCount" : ["December" : 4, "November" : 1, "January" : 1]] | |
result."2011" == ["eventCount" : 3, "monthlyCount" : ["October" : 3]] | |
and: "months are sorted" | |
mockResponse.contentAsString.indexOf("December") < mockResponse.contentAsString.indexOf("November") | |
mockResponse.contentAsString.indexOf("November") < mockResponse.contentAsString.indexOf("January") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment