Skip to content

Commit

Permalink
fix tests to check content-type for HTML views to be text/html
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyzzz committed Mar 14, 2013
1 parent c24f0b7 commit fc5b995
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/KaraTests/src/karatests/controllers/ActionTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ActionTests() {
Test fun basicHtmlLayout() {
val response = mockDispatch("GET", "/")
val output = response.stringOutput()
assertEquals("text/html", response._contentType, "Content type should be html")

assertTrue(output?.contains("Default Layout") as Boolean, "Home view contains layout")
assertTrue(output?.contains("Welcome Home") as Boolean, "Home view contains view")
}
Expand Down
5 changes: 3 additions & 2 deletions src/KaraTests/src/karatests/mock/MockHttpServletResponse.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class MockHttpServletResponse() : HttpServletResponse {

val _outSteam = ByteArrayOutputStream()
var _status = HttpServletResponse.SC_OK
public var _contentType : String? = null

public fun stringOutput() : String? {
_outSteam.flush()
Expand Down Expand Up @@ -90,7 +91,7 @@ class MockHttpServletResponse() : HttpServletResponse {
throw UnsupportedOperationException()
}
public override fun setContentType(p0 : String?) {
throw UnsupportedOperationException()
_contentType = p0
}
public override fun getCharacterEncoding() : String? {
throw UnsupportedOperationException()
Expand Down Expand Up @@ -135,4 +136,4 @@ class MockHttpServletResponse() : HttpServletResponse {
throw UnsupportedOperationException()
}

}
}

0 comments on commit fc5b995

Please sign in to comment.