We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79a68c8 commit 1cd23afCopy full SHA for 1cd23af
1 file changed
internal/renderer/templates/fixture.tmpl
@@ -72,7 +72,9 @@
72
return c
73
}
74
75
- func (f *{{ .Struct.Type.TypeName }}Fixture) Cleanup(tb testing.TB) {
+ // Cleanup calls testing.TB.Cleanup() function with providing a callback inside it.
76
+ // This callback will delete a record from the table by primary key when test will be finished.
77
+ func (f *{{ .Struct.Type.TypeName }}Fixture) Cleanup(tb testing.TB) *{{ $.Struct.Type.TypeName }}Fixture {
78
tb.Cleanup(
79
func() {
80
{{- $addPrimary := false -}}
@@ -91,6 +93,8 @@
91
93
tb.Fatalf("failed to cleanup {{ .Struct.Type.TypeName }}: %v", err)
92
94
95
})
96
+
97
+ return f
98
99
100
{{ if .Struct.HasPrimaryKey}}
0 commit comments