Skip to content

Instantly share code, notes, and snippets.

@charroch
Created April 7, 2011 22:34
Show Gist options
  • Save charroch/908930 to your computer and use it in GitHub Desktop.
Save charroch/908930 to your computer and use it in GitHub Desktop.
sequential ^
"""Given the following json {"test": "value"}""" ! c1.getJson^
"""When applying jsonpath test"""! c1.getQuery^
"""Then I should get value"""! c1.checkResutl^
end
...
"""Given the following json {"test": [2]}"""
"""When applying jsonpath test"""
"""And applying jsonpath [#]"""
"""Then I should get 2"""
"""And result of size 1"""
"""Given the following json {"test": [2,4]}"""
"""When applying jsonpath test[#]"""
"""Then I should get 2"""
"""And I should get 4"""
"""And result of size 2"""
case object c1 {
val GetJson = "Given the following json (.*)".r
val GetQuery = "When applying jsonpath (.*)".r
val CheckResult = "Then I should get (.*)".r
def getJson = (s: String) => {
val GetJson(json) = s
---> putting json in a var/map/list etc... <--
success
}
def getQuery = (s: String) => {
val GetQuery(query) = s
---> putting query in a var/map/list etc... <--
success
}
def checkResutl = (s:String) => {
val CheckResult(result) = s
---> checking result against query & json <--
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment