Skip to content

Commit

Permalink
Update specs for Registry.fromFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris O'Meara committed Jul 7, 2016
1 parent cf50999 commit 1d231a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/main/scala/com/chrisomeara/pillar/Registry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import java.util.Date
import java.io.{FileInputStream, File}

object Registry {

def apply(migrations: Seq[Migration]): Registry = {
new Registry(migrations)
}
Expand Down
14 changes: 7 additions & 7 deletions src/test/scala/com/chrisomeara/pillar/RegistrySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ class RegistrySpec extends FunSpec with BeforeAndAfter with ShouldMatchers with
val reporter = mock[Reporter]
it("returns a registry populated with reporting migrations") {
val registry = Registry.fromDirectory(new File("src/test/resources/pillar/migrations/faker/"), reporter)
registry.all(0).getClass should be(classOf[ReportingMigration])
registry.all.head.getClass should be(classOf[ReportingMigration])
}
}
}

describe("fromFiles") {
describe(".fromFiles") {
describe("without a reporter parameter") {
describe("with migration files provided") {
it("returns a registry with migrations") {
val registry = Registry.fromFiles(Seq(
new File("src/test/resources/pillar/migrations/faker/1370028262_creates_events_table.cql"),
new File("src/test/resources/pillar/migrations/faker/1370028263_creates_views_table.cql")
new File("src/test/resources/pillar/migrations/faker/1370028262000_creates_events_table.cql"),
new File("src/test/resources/pillar/migrations/faker/1370028263000_creates_views_table.cql")
))

registry.all.size should equal(2)
Expand All @@ -51,7 +51,7 @@ class RegistrySpec extends FunSpec with BeforeAndAfter with ShouldMatchers with

val registry = Registry.fromFiles(Seq(
new File("src/test/resources/pillar/migrations/faker"),
new File("src/test/resources/pillar/migrations/faker/1370028263_creates_views_table.cql")
new File("src/test/resources/pillar/migrations/faker/1370028263000_creates_views_table.cql")
))

registry.all.size should equal(1)
Expand All @@ -69,8 +69,8 @@ class RegistrySpec extends FunSpec with BeforeAndAfter with ShouldMatchers with
describe("with a reporter parameter") {
val reporter = mock[Reporter]
it("returns a registry populated with reporting migrations") {
val registry = Registry.fromFiles(Seq(new File("src/test/resources/pillar/migrations/faker/1370028263_creates_views_table.cql")), reporter);
registry.all(0).getClass should be(classOf[ReportingMigration])
val registry = Registry.fromFiles(Seq(new File("src/test/resources/pillar/migrations/faker/1370028263000_creates_views_table.cql")), reporter)
registry.all.head.getClass should be(classOf[ReportingMigration])
}
}
}
Expand Down

0 comments on commit 1d231a3

Please sign in to comment.