Skip to content

Commit

Permalink
Add failure message tests to BeElementOf matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
williammartin authored and William Martin committed May 20, 2019
1 parent 37ee382 commit efe19c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion matchers/be_element_of_matcher.go
@@ -1,4 +1,4 @@
// untested sections: 3
// untested sections: 1

package matchers

Expand Down
10 changes: 10 additions & 0 deletions matchers/be_element_of_matcher_test.go
Expand Up @@ -53,4 +53,14 @@ var _ = Describe("BeElementOf", func() {
Expect(err).Should(HaveOccurred())
})
})

It("builds failure message", func() {
actual := BeElementOf(1, 2).FailureMessage(123)
Expect(actual).To(Equal("Expected\n <int>: 123\nto be an element of\n <[]interface {} | len:2, cap:2>: [1, 2]"))
})

It("builds negated failure message", func() {
actual := BeElementOf(1, 2).NegatedFailureMessage(123)
Expect(actual).To(Equal("Expected\n <int>: 123\nnot to be an element of\n <[]interface {} | len:2, cap:2>: [1, 2]"))
})
})

0 comments on commit efe19c3

Please sign in to comment.