Skip to content

Commit

Permalink
fix naming for RT MW contract, to possibly avoid confusion with Trans…
Browse files Browse the repository at this point in the history
…port tests
  • Loading branch information
adamluzsi committed May 17, 2022
1 parent 35ccc44 commit a24ea1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions httpspec/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"github.com/adamluzsi/testcase"
)

func ItBehavesLikeRoundTripper(s *testcase.Spec, subject func(t *testcase.T, next http.RoundTripper) http.RoundTripper) {
testcase.RunContract(s, RoundTripperContract{Subject: subject})
func ItBehavesLikeRoundTripperMiddleware(s *testcase.Spec, subject func(t *testcase.T, next http.RoundTripper) http.RoundTripper) {
testcase.RunContract(s, RoundTripperMiddlewareContract{Subject: subject})
}

type RoundTripperContract struct {
type RoundTripperMiddlewareContract struct {
Subject func(t *testcase.T, next http.RoundTripper) http.RoundTripper
}

func (c RoundTripperContract) Spec(s *testcase.Spec) {
func (c RoundTripperMiddlewareContract) Spec(s *testcase.Spec) {
s.Context(`it behaves like round-tripper`, func(s *testcase.Spec) {
expectedBody := testcase.Let(s, func(t *testcase.T) string {
return t.Random.String()
Expand Down
4 changes: 2 additions & 2 deletions httpspec/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (

func TestItBehavesLikeRoundTripper(t *testing.T) {
s := testcase.NewSpec(t)
httpspec.ItBehavesLikeRoundTripper(s, func(t *testcase.T, next http.RoundTripper) http.RoundTripper {
httpspec.ItBehavesLikeRoundTripperMiddleware(s, func(t *testcase.T, next http.RoundTripper) http.RoundTripper {
return ExampleRoundTripper{Next: next}
})
}

func TestRoundTripperContract_Spec(t *testing.T) {
testcase.RunContract(t, httpspec.RoundTripperContract{
testcase.RunContract(t, httpspec.RoundTripperMiddlewareContract{
Subject: func(t *testcase.T, next http.RoundTripper) http.RoundTripper {
return ExampleRoundTripper{Next: next}
},
Expand Down

0 comments on commit a24ea1d

Please sign in to comment.