Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Both assertHeaderExists functions now behave in the same way. #323

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ abstract class TestRouteResult(_result: RouteResult, awaitAtMost: FiniteDuration
def assertEntityAs[T <: AnyRef](unmarshaller: Unmarshaller[HttpEntity, T], expected: T): TestRouteResult =
assertEqualsKind(expected, entity(unmarshaller), "entity")

/**
* Assert that a given header instance exists in the response.
*/
def assertHeaderExists(expected: HttpHeader): TestRouteResult = {
assertTrue(response.headers.exists(_ == expected), s"Header $expected was missing.")
this
}

/**
* Assert that a header of the given type exists.
*/
Expand Down Expand Up @@ -217,6 +209,12 @@ abstract class TestRouteResult(_result: RouteResult, awaitAtMost: FiniteDuration
this
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional. Otherwise, the function given to the filter will call name.toRootLowerCase for every header during the iteration.


/**
* Assert that a given header instance exists in the response.
*/
def assertHeaderExists(expected: HttpHeader): TestRouteResult =
assertHeaderExists(expected.name(), expected.value())

@varargs def assertRejections(expectedRejections: Rejection*): TestRouteResult = {
if (rejections.asScala == expectedRejections.toSeq) {
this
Expand Down