Test Updates with blank values

This commit is contained in:
Jinzhu 2016-02-18 20:51:49 +08:00
parent 115789960a
commit 52ae6df6fd
1 changed files with 16 additions and 0 deletions

View File

@ -420,6 +420,22 @@ func TestUpdateColumnsSkipsAssociations(t *testing.T) {
}
}
func TestUpdatesWithBlankValues(t *testing.T) {
t.Skip("not implemented")
product := Product{Code: "product1", Price: 10}
DB.Save(&product)
DB.Model(&Product{Id: product.Id}).Updates(&Product{Price: 100})
var product1 Product
DB.First(&product1, product.Id)
if product1.Code != "product1" || product1.Price != 100 {
t.Errorf("product's code should not be updated")
}
}
func TestUpdateDecodeVirtualAttributes(t *testing.T) {
t.Skip("not implemented")