Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
IainHull committed Jun 27, 2013
1 parent 0bf28e7 commit 8dbe029
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/test/scala/org/iainhull/resttest/ApiTest.scala
Expand Up @@ -35,19 +35,19 @@ class ApiTest extends FlatSpec with ShouldMatchers {

"A RequestBuilder" should "simplify the creation of request objects" in {
val request1: Request = RequestBuilder().withMethod(GET).withUrl("http://localhost/").withBody("body").toRequest
request1 should have('method(GET), 'uri(new URI("http://localhost/")), 'body(Some("body")))
request1 should have('method(GET), 'url(new URI("http://localhost/")), 'body(Some("body")))

val request2: Request = RequestBuilder().withMethod(GET).withUrl("http://localhost/").addPath("foo").addPath("bar").toRequest
request2 should have('method(GET), 'uri(new URI("http://localhost/foo/bar")))
request2 should have('method(GET), 'url(new URI("http://localhost/foo/bar")))
}

it should "support reuse of partialy constructed builders (ensure builder is immutable)" in {
val base = RequestBuilder().withMethod(GET).withUrl("http://localhost/").withBody("body")
val rb1 = base.withMethod(POST).addPath("foo")
val rb2 = base.withBody("everybody")

base.toRequest should have('method(GET), 'uri(new URI("http://localhost/")), 'body(Some("body")))
rb1.toRequest should have('method(POST), 'uri(new URI("http://localhost/foo")), 'body(Some("body")))
rb2.toRequest should have('method(GET), 'uri(new URI("http://localhost/")), 'body(Some("everybody")))
base.toRequest should have('method(GET), 'url(new URI("http://localhost/")), 'body(Some("body")))
rb1.toRequest should have('method(POST), 'url(new URI("http://localhost/foo")), 'body(Some("body")))
rb2.toRequest should have('method(GET), 'url(new URI("http://localhost/")), 'body(Some("everybody")))
}
}

0 comments on commit 8dbe029

Please sign in to comment.