如何获取变量值是spec语句?

时间:2016-02-15 14:56:04

标签: scala specifications scalatest specs2

我有这样的代码

 "When some call is made, status is (+value+)" in {
        Get("/path") ~> routeToCall ~> check {
           // some statements
           status === OK  <---- this value I want in When Statment
        }
      }

无论我们得到什么状态是好还是失败,我都想在“当.......状态正常”的某些事情上。

1 个答案:

答案 0 :(得分:0)

使用specs2-gwt模块,您可以编写类似

的内容
class APISpec extends mutable.Specification with 
   org.specs2.specification.dsl.mutable.GWT with   
   StandardDelimitedStepParsers {

   "When some call is made, status is {OK}".example(aString) { expected: String =>
     Get("/path") ~> routeToCall ~> check {
       // some statements
       status === expected
     }
   }
}

请查看documentation了解更多示例。