Skip to content

Commit

Permalink
daveD - refactors and moves. random still not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Oct 24, 2015
1 parent 3868cda commit 8b1d293
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/io/github/databob/Databob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class Databob(generators: Generators = new Generators()) {
}

object Databob {
def mk[A](implicit generators: Generators, mf: Manifest[A]): A = new Databob(generators).mk[A]
def mk[A](implicit generators: Generators = Empty, mf: Manifest[A]): A = new Databob(generators).mk[A]

def default[A](implicit overrides: Generators, mf: Manifest[A]): A = mk[A](overrides ++ Default, mf)
def default[A](implicit overrides: Generators = Empty, mf: Manifest[A]): A = mk[A](overrides ++ Default, mf)

def random[A](implicit overrides: Generators, mf: Manifest[A]): A = mk[A](overrides ++ Random, mf)
def random[A](implicit overrides: Generators = Empty, mf: Manifest[A]): A = mk[A](overrides ++ Random, mf)
}
3 changes: 3 additions & 0 deletions src/main/scala/io/github/databob/generators/Generators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class Generators(generators: Iterable[Generator[_]] = Nil) extends Iterable[Gene


object Generators {

val Empty = new Generators()

val Default =
JavaPrimitiveGenerators.Default ++
ScalaPrimitiveGenerators.Default ++
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/databob/unit/DatabobTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DatabobTest extends FunSpec with ShouldMatchers {

def itSupports[A: Manifest](implicit mf: Manifest[A]): Unit = {
it(name + " : " + mf.runtimeClass.getSimpleName) {
Databob.mk[A](Default, mf) === null shouldBe false
Databob.mk[A](generators, mf) === null shouldBe false
}
}

Expand Down

0 comments on commit 8b1d293

Please sign in to comment.