Skip to content
This repository has been archived by the owner on Jul 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33 from guardian/syntatic-refactor
Browse files Browse the repository at this point in the history
Syntactic refactor
  • Loading branch information
Mario Galic committed Jan 28, 2018
2 parents 06370cf + b08835e commit 714827e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/com/gu/tip/PathsActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class PathsActor(val paths: Map[String, EnrichedPath])
} recover {
case e: NoSuchElementException =>
logger.error(
s"Unrecognized path name. Available paths: ${paths.map(_._1).mkString(",")}")
s"Unrecognized path name. Available paths: ${paths.keys.mkString(",")}")
sender() ! PathDoesNotExist(pathname)
}

Expand Down
15 changes: 9 additions & 6 deletions src/test/scala/com/gu/tip/TipTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import org.scalatest.{AsyncFlatSpec, MustMatchers}

class TipTest extends AsyncFlatSpec with MustMatchers {

// implicit val strategy = Strategy.fromExecutionContext(scala.concurrent.ExecutionContext.Implicits.global)

private val mockOkResponse: WriterT[IO, List[Log], String] =
WriterT(
IO(
Expand All @@ -22,10 +20,13 @@ class TipTest extends AsyncFlatSpec with MustMatchers {

trait MockHttpClient extends HttpClient {
override def get(endpoint: String = "",
authHeader: (String, String) = ("", "")) = mockOkResponse
authHeader: (String, String) = ("", ""))
: WriterT[IO, List[Log], String] = mockOkResponse

override def post(endpoint: String = "",
authHeader: (String, String) = ("", ""),
jsonBody: String = "") = mockOkResponse
jsonBody: String = ""): WriterT[IO, List[Log], String] =
mockOkResponse
}

object Tip extends Tip with Notifier with GitHubApi with MockHttpClient
Expand Down Expand Up @@ -95,7 +96,8 @@ class TipTest extends AsyncFlatSpec with MustMatchers {

it should "set the label when all paths are verified" in {
trait MockNotifier extends NotifierIf { this: GitHubApiIf =>
override def setLabelOnLatestMergedPr() = mockOkResponse
override def setLabelOnLatestMergedPr(): WriterT[IO, List[Log], String] =
mockOkResponse
}

object Tip extends Tip with MockNotifier with GitHubApi with MockHttpClient
Expand All @@ -108,7 +110,8 @@ class TipTest extends AsyncFlatSpec with MustMatchers {

it should "not set the label if the same path is verified multiple times concurrently (no race conditions)" in {
trait MockNotifier extends NotifierIf { this: GitHubApiIf =>
override def setLabelOnLatestMergedPr = mockOkResponse
override def setLabelOnLatestMergedPr: WriterT[IO, List[Log], String] =
mockOkResponse
}

object Tip extends Tip with MockNotifier with GitHubApi with MockHttpClient
Expand Down

0 comments on commit 714827e

Please sign in to comment.