Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GCrispino committed Jan 5, 2024
1 parent 620b666 commit b5c8f21
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions _examples/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"net/http/httptest"
"testing"

"github.com/regen-network/gocuke"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/regen-network/gocuke"
)

type suite struct {
Expand All @@ -19,7 +20,12 @@ type suite struct {

func TestApi(t *testing.T) {
scope := &suite{TestingT: t, resp: httptest.NewRecorder()}
gocuke.NewRunner(t, scope).
run := gocuke.NewRunner(t, scope)
run.Before(func() {
scope.resp = httptest.NewRecorder()
})

run.
Step(`^I send "(GET|POST|PUT|DELETE)" request to "([^"]*)"$`, scope.ISendRequestTo).
Step(`^the response code should be (\d+)$`, scope.TheResponseCodeShouldBe).
Step(`^the response should match json:$`, scope.TheResponseShouldMatchJson).
Expand Down

0 comments on commit b5c8f21

Please sign in to comment.