4 . "github.com/onsi/ginkgo"
5 . "github.com/onsi/gomega"
6 . "github.com/onsi/gomega/matchers"
9 var _ = Describe("ContainSubstringMatcher", func() {
10 Context("when actual is a string", func() {
11 It("should match against the string", func() {
12 Ω("Marvelous").Should(ContainSubstring("rve"))
13 Ω("Marvelous").ShouldNot(ContainSubstring("boo"))
17 Context("when the matcher is called with multiple arguments", func() {
18 It("should pass the string and arguments to sprintf", func() {
19 Ω("Marvelous3").Should(ContainSubstring("velous%d", 3))
23 Context("when actual is a stringer", func() {
24 It("should call the stringer and match agains the returned string", func() {
25 Ω(&myStringer{a: "Abc3"}).Should(ContainSubstring("bc3"))
29 Context("when actual is neither a string nor a stringer", func() {
30 It("should error", func() {
31 success, err := (&ContainSubstringMatcher{Substr: "2"}).Match(2)
32 Ω(success).Should(BeFalse())
33 Ω(err).Should(HaveOccurred())