Repository: stretchr/testify (go)

Issue:
assert.ObjectsAreEqual work not correct with serialized\deserialized time.Time
**time.Time** not equals before and after serialization/deserialization to JSON on machine in **UTC**
reason: https://github.com/golang/go/issues/19486#issuecomment-292610767

code: https://play.golang.org/p/H0ACWIBZE3O

solution: change the **time.Time** comparison format. For example, compare time using **time.Equal**

Pull request description:
Compare time.Time objects for equality correctly
Adding test

## Summary
Fix assert.ObjectsAreEqual bug with not equals time.Time before and after serializing\deserializing

## Changes
Added a check in ObectsAreEqual in case the arguments are a time object

## Motivation
Fix bug to use test in docker 

## Related issues
Closes #950 
Fix #951 


Patch:
diff --git a/assert/assertions.go b/assert/assertions.go
index 6c629e8..94fb18c 100644
--- a/assert/assertions.go
+++ b/assert/assertions.go
@@ -60,6 +60,16 @@ func ObjectsAreEqual(expected, actual interface{}) bool {
 		return expected == actual
 	}
 
+	tExp, ok := expected.(time.Time)
+	if ok {
+
+		tAct, ok := actual.(time.Time)
+		if ok {
+			return tExp.Equal(tAct)
+		}
+		return false
+	}
+
 	exp, ok := expected.([]byte)
 	if !ok {
 		return reflect.DeepEqual(expected, actual)


Test patch:
diff --git a/assert/assertions_test.go b/assert/assertions_test.go
index f32362b..5755f1a 100644
--- a/assert/assertions_test.go
+++ b/assert/assertions_test.go
@@ -148,6 +148,21 @@ func TestObjectsAreEqual(t *testing.T) {
 
 }
 
+func TestObjectsAreEqual_SerializedTime(t *testing.T) {
+	t0 := time.Now().Round(0)
+	b, err := json.Marshal(t0)
+	if err != nil {
+		t.Fail()
+	}
+	var t1 time.Time
+	if err := json.Unmarshal(b, &t1); err != nil {
+		t.Fail()
+	}
+	if !ObjectsAreEqual(t0, t1) {
+		t.Errorf("time must be equals")
+	}
+}
+
 func TestImplements(t *testing.T) {
 
 	mockT := new(testing.T)