Skip to content

Commit 7fe2a85

Browse files
committed
Clarification in README
Update some of the readme wording and some typos
1 parent 52bc166 commit 7fe2a85

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ There are two possible ways to use `mocket`:
3333

3434
##### Enabling driver
3535

36-
Somewhere in your code to set up a tests
36+
Somewhere in your code, do this to set up a tests
3737

3838
```go
3939
import (
@@ -46,14 +46,14 @@ func SetupTests() {
4646
mocket.Catcher.Register()
4747
// GORM
4848
db, err := gorm.Open(mocket.DRIVER_NAME, "any_string") // Could be any connection string
49-
app.DB = db // assumption that it will be used everywhere the same
49+
app.DB = db // Assumption that it will be used everywhere the same
5050
//OR
5151
// Regular sql package usage
5252
db, err := sql.Open(mocket.DRIVER_NAME, "any_string")
5353
}
5454
```
5555

56-
Now if use singleton instance of DB, it uses everywhere mocked connection.
56+
Now, if you use a singleton instance of DB, it will use a mocked connection everywhere.
5757

5858
##### Chain usage
5959

@@ -70,7 +70,8 @@ func TestHandler(t *testing.T) {
7070
GlobalMock := mocket.Catcher
7171
GlobalMock.Logging = true // log mocket behavior
7272

73-
commonReply := []map[string]interface{}{{"id": "2", "field": "value"}}
73+
// field names here mapped to the database schema
74+
commonReply := []map[string]interface{}{{"some_id": "2", "field": "value"}}
7475
// Mock only by query pattern
7576
GlobalMock.NewMock().WithQuery(`"campaigns".name IS NULL AND (("uuid" = test_uuid))`).WithReply(commonReply)
7677
Post(recorder, request) // call handler

0 commit comments

Comments
 (0)