test: update Save test

This commit is contained in:
riverchu 2021-09-05 23:07:28 +08:00 committed by Jinzhu
parent c898622791
commit 4581e8b590
1 changed files with 2 additions and 2 deletions

View File

@ -651,14 +651,14 @@ func TestSave(t *testing.T) {
} }
user3.Name = "save3_" user3.Name = "save3_"
DB.Model(User{}).Save(&user3) DB.Model(User{Model: user3.Model}).Save(&user3)
var result2 User var result2 User
if err := DB.First(&result2, "name = ?", "save3_").Error; err != nil || result2.ID != user3.ID { if err := DB.First(&result2, "name = ?", "save3_").Error; err != nil || result2.ID != user3.ID {
t.Fatalf("failed to find updated user") t.Fatalf("failed to find updated user")
} }
DB.Model(User{}).Save(&struct { DB.Debug().Model(User{Model: user3.Model}).Save(&struct {
gorm.Model gorm.Model
Placeholder string Placeholder string
Name string Name string