initial commit
[govpp.git] / vendor / github.com / onsi / gomega / matchers / contain_substring_matcher_test.go
1 package matchers_test
2
3 import (
4         . "github.com/onsi/ginkgo"
5         . "github.com/onsi/gomega"
6         . "github.com/onsi/gomega/matchers"
7 )
8
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"))
14                 })
15         })
16
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))
20                 })
21         })
22
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"))
26                 })
27         })
28
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())
34                 })
35         })
36 })