Skip to content

Commit

Permalink
fix stub typo to spy (quii#757)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmedina-dev authored May 6, 2024
1 parent db59555 commit 7c5b39c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions context.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ type Store interface {

The returned function calls the `store`'s `Fetch` method to get the data and writes it to the response.

We have a corresponding stub for `Store` which we use in a test.
We have a corresponding spy for `Store` which we use in a test.

```go
type StubStore struct {
type SpyStore struct {
response string
}

func (s *StubStore) Fetch() string {
func (s *SpyStore) Fetch() string {
return s.response
}

func TestServer(t *testing.T) {
data := "hello, world"
svr := Server(&StubStore{data})
svr := Server(&SpyStore{data})

request := httptest.NewRequest(http.MethodGet, "/", nil)
response := httptest.NewRecorder()
Expand Down

0 comments on commit 7c5b39c

Please sign in to comment.