<commit_before>
package org.scalariver

import org.specs2.mutable.Specification
import spray.testkit.Specs2RouteTest
import spray.http.StatusCodes._
import spray.http.FormData

class ScalariverCanSpec extends Specification with Specs2RouteTest with FormattingService {

  def actorRefFactory = system
  val myRoute = formatRoute

  val test1 = """
  object Test {
    val map = Map("hello" -> "yoh")
  }
  """

  val test2 = """
  object Test2 {
    def sayYes(p: String) = p match {
      case "Yes" => "Im saying yes"
      case _ => "Nah,"
    }
  }
  """
  val expTest2 = """
  object Test2 {
    def sayYes(p: String) = p match {
      case "Yes" ⇒ "Im saying yes"
      case _ ⇒ "Nah,"
    }
  }"""

  "The service" should {
    "return formatted source code" in {
      Post("/", FormData(Map("source" -> test2, "scalaVersion" -> "2.11.2", "initialIndentLevel" -> "2", "rewriteArrowSymbols" -> "true"))) ~>
        myRoute ~> check {
          val output = responseAs[String]
          println(output)
          output === expTest2
        }
    }
  }
}<commit_msg>test spec fix for post request<commit_after>package org.scalariver

import org.specs2.mutable.Specification
import spray.testkit.Specs2RouteTest
import spray.http.StatusCodes._
import spray.http.FormData

class ScalariverCanSpec extends Specification with Specs2RouteTest with FormattingService {

  def actorRefFactory = system
  val myRoute = formatRoute

  val test2 =
    """|object Test {
|  def sayYes(ans: String) = p match {
|    case "Yes" => "I'm saying yes!"
|    case _ => "Nothing to say..."
|  }
|}""".stripMargin

  val expTest2 =
    """|object Test {
|  def sayYes(ans: String) = p match {
|    case "Yes" ⇒ "I'm saying yes!"
|    case _ ⇒ "Nothing to say..."
|  }
|}""".stripMargin

  "The service" should {
    "response to a POST request and return a formatted source code" in {
      Post("/", FormData(Map("source" -> test2, "scalaVersion" -> "2.11.2", "initialIndentLevel" -> "0", "rewriteArrowSymbols" -> "true"))) ~>
        myRoute ~> check {
          val output = responseAs[String]
          println(output)
          output === expTest2
        }
    }
  }

  "The service" should {
    "not response to a GET request and return formatted source code" in {
      Get("/", FormData(Map("source" -> test2, "scalaVersion" -> "2.11.2", "initialIndentLevel" -> "2", "rewriteArrowSymbols" -> "true"))) ~>
        myRoute ~> check {
          val output = responseAs[String]
          output === expTest2
        }
    }
  }
}
{'fraction_non_alphanumeric': 0.13923046410154702, 'fraction_numerical': 0.013486711622372074, 'mean_word_length': 2.764179104477612, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3817430', 'n_tokens_mistral': 838, 'n_tokens_neox': 824, 'n_words': 224}