From a24ea1d12050a53bdd77b138ed8db85574bca3d7 Mon Sep 17 00:00:00 2001 From: Adam Luzsi Date: Tue, 17 May 2022 02:03:31 +0200 Subject: [PATCH] fix naming for RT MW contract, to possibly avoid confusion with Transport tests --- httpspec/contracts.go | 8 ++++---- httpspec/contracts_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/httpspec/contracts.go b/httpspec/contracts.go index c40f7f1..a5063de 100644 --- a/httpspec/contracts.go +++ b/httpspec/contracts.go @@ -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() diff --git a/httpspec/contracts_test.go b/httpspec/contracts_test.go index 4b20aa4..a796c6f 100644 --- a/httpspec/contracts_test.go +++ b/httpspec/contracts_test.go @@ -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} },