Fixed conversion of GString to String; fixes gh-762
This commit is contained in:
@@ -101,6 +101,10 @@ class Request extends Common {
|
||||
this.urlPath = new UrlPath(path)
|
||||
}
|
||||
|
||||
void urlPath(GString path) {
|
||||
this.urlPath = new UrlPath(path)
|
||||
}
|
||||
|
||||
void urlPath(DslProperty path) {
|
||||
this.urlPath = new UrlPath(path)
|
||||
}
|
||||
@@ -111,6 +115,12 @@ class Request extends Common {
|
||||
closure()
|
||||
}
|
||||
|
||||
void urlPath(GString path, @DelegatesTo(UrlPath) Closure closure) {
|
||||
this.urlPath = new UrlPath(path)
|
||||
closure.delegate = urlPath
|
||||
closure()
|
||||
}
|
||||
|
||||
void urlPath(DslProperty path, @DelegatesTo(UrlPath) Closure closure) {
|
||||
this.urlPath = new UrlPath(path)
|
||||
closure.delegate = urlPath
|
||||
|
||||
@@ -35,6 +35,10 @@ class UrlPath extends Url {
|
||||
super(path)
|
||||
}
|
||||
|
||||
UrlPath(GString path) {
|
||||
super(path)
|
||||
}
|
||||
|
||||
UrlPath(DslProperty path) {
|
||||
super(path)
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ class MockMvcMethodBodyBuilderSpec extends Specification implements WireMockStub
|
||||
Contract contractDsl = Contract.make {
|
||||
request {
|
||||
method 'GET'
|
||||
urlPath('/users') {
|
||||
urlPath("/users/${value(regex("1"))}") {
|
||||
queryParameters {
|
||||
parameter 'limit': $(consumer(equalTo("20")), producer(equalTo("10")))
|
||||
parameter 'offset': $(consumer(containing("20")), producer(equalTo("20")))
|
||||
@@ -665,7 +665,7 @@ class MockMvcMethodBodyBuilderSpec extends Specification implements WireMockStub
|
||||
test.contains('''.queryParam("age","99")''')
|
||||
test.contains('''.queryParam("name","Denis.Stepanov")''')
|
||||
test.contains('''.queryParam("email","bob@email.com")''')
|
||||
test.contains('''.get("/users")''')
|
||||
test.contains('''.get("/users/1")''')
|
||||
test.contains('assertThatJson(parsedJson).field("[\'property1\']").isEqualTo("a")')
|
||||
test.contains('assertThatJson(parsedJson).field("[\'property2\']").isEqualTo("b")')
|
||||
and:
|
||||
|
||||
Reference in New Issue
Block a user