You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you set up a test using the ghttp server with NewWithT and NewGHTTPWithGomega, then use the VerifyJSON handler, the ghttp server responds with 500. (For more background, see #321 (comment) for an example of using ghttp with the XUnit style of tests calling NewWithT.)
Here's an example with github.com/onsi/gomega@v1.13.0:
$ go test
--- FAIL: Test (0.00s)
main_test.go:28:
Expected
<int>: 500
to equal
<int>: 201
FAIL
exit status 1
I expect the test to pass instead of fail.
What I think is happening is that the VerifyMimeType call in VerifyJSON is using the package level gomega instead of using the GHTTPWithGomega struct that's passed around.
The GHTTPWithGomega struct has receiver functions to allow XUnit style
tests to use the ghttp server. However, some of these receiver functions
call out to Verify functions that use the package level gomega instead
of the struct's gomega.
Fixesonsi#453
If you set up a test using the ghttp server with
NewWithT
andNewGHTTPWithGomega
, then use theVerifyJSON
handler, the ghttp server responds with 500. (For more background, see #321 (comment) for an example of using ghttp with the XUnit style of tests callingNewWithT
.)Here's an example with
github.com/onsi/gomega@v1.13.0
:Running the test:
I expect the test to pass instead of fail.
What I think is happening is that the
VerifyMimeType
call inVerifyJSON
is using the package levelgomega
instead of using theGHTTPWithGomega
struct that's passed around.gomega/ghttp/handlers.go
Line 134 in 9da0d13
I think this call should be
g.VerifyMimeType("application/json")
to use the correctgomega
.I'm happy to submit a PR to fix this so that the verify receiver functions call other receiver functions. Let me know! 😃
The text was updated successfully, but these errors were encountered: