From 52ae6df6fd14fcc81ff215d79a13d8effab5ba39 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 18 Feb 2016 20:51:49 +0800 Subject: [PATCH] Test Updates with blank values --- update_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/update_test.go b/update_test.go index c3801c37..417463bb 100644 --- a/update_test.go +++ b/update_test.go @@ -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")