Skip to content

Commit

Permalink
Use akka.stream.Materializer
Browse files Browse the repository at this point in the history
Play 2.5 requires an implicit akka.stream.Materializer for a Filter
  • Loading branch information
edvakf committed Jun 22, 2016
1 parent 52f2910 commit 8e60d60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import java.util.concurrent.atomic.AtomicInteger

import scala.concurrent.Future
import play.api.libs.concurrent.Execution.Implicits._
import akka.stream.Materializer

class RequestCountFilter @Inject() (configuration: Configuration) extends Filter {
class RequestCountFilter @Inject() (configuration: Configuration)(implicit val mat: Materializer) extends Filter {

val maybePath = configuration.getString("requestcount.path")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package com.github.edvakf.play.requestcount
import org.scalatest.FunSuite
import play.api.Configuration
import play.api.mvc.{Action, Result, Results}
import play.api.test.FakeRequest
import play.api.test.{FakeApplication, FakeRequest}
import play.api.test.Helpers._

import scala.concurrent.Promise

class RequestCountFilterTest extends FunSuite {

test("returns zero by default") {
implicit val materializer = FakeApplication().materializer
val config = Configuration("requestcount.path" -> "/requestcount")
val filter = new RequestCountFilter(config)

Expand All @@ -23,6 +24,7 @@ class RequestCountFilterTest extends FunSuite {
}

test("increment and decrement") {
implicit val materializer = FakeApplication().materializer
val config = Configuration("requestcount.path" -> "/requestcount")
val filter = new RequestCountFilter(config)

Expand All @@ -47,6 +49,7 @@ class RequestCountFilterTest extends FunSuite {
}

test("nothing happens if config is not set") {
implicit val materializer = FakeApplication().materializer
val config = Configuration()
val filter = new RequestCountFilter(config)

Expand Down

0 comments on commit 8e60d60

Please sign in to comment.