Skip to content

Commit

Permalink
Merge pull request #58 from sullivan-/feat/zone
Browse files Browse the repository at this point in the history
give ArbitraryJoda.arbJoda a time zone
  • Loading branch information
juanpedromoreno committed Oct 27, 2017
2 parents 58517ab + 9955938 commit 01bd56f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ trait GenJoda {
object GenJoda extends GenJoda

object ArbitraryJoda extends GenJoda {
implicit val arbJoda: Arbitrary[DateTime] = Arbitrary(genDateTime)
implicit def arbJoda(implicit zone: DateTimeZone = DateTimeZone.getDefault): Arbitrary[DateTime] =
Arbitrary(genDateTime.map(_.withZone(zone)))
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ object GenJodaProperties extends Properties("Joda Generators") {
property("arbitrary generation creates valid DateTime instances (with no granularity)") = {
import ArbitraryJoda._
forAll { dt: DateTime =>
passed
dt.getZone == DateTimeZone.getDefault
}
}

property("arbitrary generation creates DateTime instances with right time zone") = {
implicit val zone = DateTimeZone.UTC
import ArbitraryJoda._
forAll { dt: DateTime =>
dt.getZone == zone
}
}

Expand Down

0 comments on commit 01bd56f

Please sign in to comment.