Created
April 23, 2014 12:52
-
-
Save chrissie1/11214114 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
val data = listOf( | |
-1 to "one second ago", | |
-10 to "10 seconds ago", | |
-59 to "59 seconds ago", | |
-60 to "a minute ago", | |
1 to "one second from now", | |
10 to "10 seconds from now", | |
59 to "59 seconds from now", | |
60 to "a minute from now" | |
) | |
givenData("timeunit in seconds" ,data) { | |
val (input, excpected) = it | |
on("calling humanize with ${input}", { | |
val datetouse = GregorianCalendar(2014,Calendar.JANUARY, 5).getTime() | |
val (input, excpected) = it | |
val cal = GregorianCalendar() | |
cal.setTime(input) | |
cal.add(Calendar.SECOND, input) | |
val actual = cal.getTime().humanize(input) | |
it("should be ${expected}", { | |
shouldEqual(expected, actual) | |
}) | |
}) | |
} |
"calling humanize on Date comparing against inputdate ${input} seconds"
Seems like I'm writing a book.
given("current time")
on("calling humanize with ${input} in seconds") {
it("should give ${expected}")
Also, the datetouse should be defined in the given. The On should only contain the actual action. Everything that is setting up the context should be in given.
So I need you to create a givenData with a description in Spek and then I'll make it work for you.
IT also makes me realize we need to rename givenData and also maybe add annotation title.
IT also makes me realize we need to rename givenData and also maybe add annotation title.
IT also makes me realize we need to rename givenData and also maybe add annotation title.
I get IT.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, good but calling humanize on what?