Repository: go-bdd/gobdd (go)

Issue:
ctx.GetError should not return err if there's nil
**Describe the bug**

Here's sample code:

```go
func itReturnsNoError(t gobdd.StepTest, ctx context.Context) context.Context {
	res, err := ctx.GetError(statsErrKey{})
	if err != nil {
		t.Error(err)
	}
	if res != nil {
		t.Errorf("expected no error but %+v received", res)
	}
	
	return ctx
}
```

When I want to check if the `GetError` returns an error, sometimes I want to get `nil` from it. But, in such case the `GetError` will return the `err` as the second returned value. It should be `nil` as well.


Pull request description:
Return no error if ctx.GetError returns nil
Fixes #93 

Patch:
diff --git a/context/context.go b/context/context.go
index 8f297cd..8a8783a 100644
--- a/context/context.go
+++ b/context/context.go
@@ -44,6 +44,10 @@ func (ctx Context) GetError(key interface{}, defaultValue ...interface{}) (inter
 		return nil, fmt.Errorf("the key %+v does not exist", key)
 	}
 
+	if ctx.values[key] == nil {
+		return nil, nil
+	}
+
 	value, ok := ctx.values[key].(error)
 	if !ok {
 		return nil, fmt.Errorf("the expected value is not error  (%T)", key)
diff --git a/go.mod b/go.mod
index ba3bc61..60ca666 100644
--- a/go.mod
+++ b/go.mod
@@ -7,4 +7,5 @@ require (
 	github.com/cucumber/messages-go/v9 v9.0.3
 	github.com/go-bdd/assert v0.0.0-20190820124234-20d47a68475d
 	github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381
+	github.com/stretchr/testify v1.4.0
 )


Test patch:
diff --git a/context/context_test.go b/context/context_test.go
new file mode 100644
index 0000000..a166ca4
--- /dev/null
+++ b/context/context_test.go
@@ -0,0 +1,16 @@
+package context
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestNilInGetError(t *testing.T) {
+	ctx := New()
+	ctx.Set("err", nil)
+
+	res, err := ctx.GetError("err")
+	assert.NoError(t, err)
+	assert.Nil(t, res)
+}