Polish "Provide more control of formatting of curl and HTTPie commands"
See gh-348 Closes gh-260
This commit is contained in:
@@ -70,6 +70,7 @@ import static org.springframework.restdocs.test.SnippetMatchers.snippet;
|
||||
* Integration tests for using Spring REST Docs with REST Assured.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Tomasz Kopczynski
|
||||
*/
|
||||
public class RestAssuredRestDocumentationIntegrationTests {
|
||||
|
||||
@@ -101,10 +102,11 @@ public class RestAssuredRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-content/curl-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content(String.format("$ curl 'http://localhost:" + tomcat.getPort() + "/' -i "
|
||||
+ "-X POST \\%n -H 'Accept: application/json' "
|
||||
+ "\\%n -H 'Content-Type: " + contentType + "' "
|
||||
+ "\\%n -d 'content'")))));
|
||||
.content(String.format("$ curl 'http://localhost:"
|
||||
+ tomcat.getPort() + "/' -i -X POST \\%n"
|
||||
+ " -H 'Accept: application/json' \\%n"
|
||||
+ " -H 'Content-Type: " + contentType + "' \\%n"
|
||||
+ " -d 'content'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,11 +120,12 @@ public class RestAssuredRestDocumentationIntegrationTests {
|
||||
assertThat(
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-cookies/curl-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content(String.format("$ curl 'http://localhost:" + tomcat.getPort() + "/' -i "
|
||||
+ "\\%n -H 'Accept: application/json' " + "\\%n -H 'Content-Type: "
|
||||
+ contentType + "' "
|
||||
+ "\\%n --cookie 'cookieName=cookieVal'")))));
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(),
|
||||
"bash").content(String.format("$ curl 'http://localhost:"
|
||||
+ tomcat.getPort() + "/' -i \\%n"
|
||||
+ " -H 'Accept: application/json' \\%n"
|
||||
+ " -H 'Content-Type: " + contentType + "' \\%n"
|
||||
+ " --cookie 'cookieName=cookieVal'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,10 +140,11 @@ public class RestAssuredRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-query-string/curl-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content(String.format("$ curl " + "'http://localhost:" + tomcat.getPort()
|
||||
+ "/?foo=bar' -i -X POST "
|
||||
+ "\\%n -H 'Accept: application/json' " + "\\%n -H 'Content-Type: "
|
||||
+ contentType + "' " + "\\%n -d 'a=alpha'")))));
|
||||
.content(String.format("$ curl " + "'http://localhost:"
|
||||
+ tomcat.getPort() + "/?foo=bar' -i -X POST \\%n"
|
||||
+ " -H 'Accept: application/json' \\%n"
|
||||
+ " -H 'Content-Type: " + contentType + "' \\%n"
|
||||
+ " -d 'a=alpha'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user