-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencode_document_test.go
32 lines (28 loc) · 923 Bytes
/
encode_document_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package jsonapi_test
import (
"github.com/ryanmoran/jsonapi"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("EncodeDocument", func() {
Describe("NewSingularEncodeDocument", func() {
Context("failure cases", func() {
Context("when the payload is not encodable", func() {
It("returns an error", func() {
_, err := jsonapi.NewSingularEncodeDocument("some-payload")
Expect(err).To(MatchError("cannot encode string some-payload: does not implement jsonapi.Encodable"))
})
})
})
})
Describe("NewMultipleEncodeDocument", func() {
Context("failure cases", func() {
Context("when the payload is not encodable", func() {
It("returns an error", func() {
_, err := jsonapi.NewMultipleEncodeDocument([]string{"some-payload"})
Expect(err).To(MatchError("cannot encode string some-payload: does not implement jsonapi.Encodable"))
})
})
})
})
})