forked from gnames/bhlindex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbhlindex_test.go
43 lines (38 loc) · 889 Bytes
/
bhlindex_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
33
34
35
36
37
38
39
40
41
42
43
package bhlindex_test
import (
"errors"
"fmt"
"github.com/gnames/bhlindex"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("bhlindex", func() {
Describe("Check()", func() {
It("ignores `nil` errors", func() {
err := error(nil)
a := "one"
bhlindex.Check(err)
Expect(a).To(Equal("one"))
})
It("panics if err is not `nil`", func() {
defer func() {
if r := recover(); r != nil {
e := r.(error)
Expect(e).To(Equal(errors.New("My error")))
}
}()
err := errors.New("My error")
bhlindex.Check(err)
})
})
Describe("EnvVars", func() {
env := bhlindex.EnvVars()
It("Returns envaronment variables", func() {
fmt.Println(env)
Expect(env.BHLDir).To(Equal("./testdata/"))
Expect(env.Db).To(Equal("bhlindex"))
Expect(env.DbUser).To(Equal("postgres"))
Expect(env.DbHost).To(Equal("pg"))
})
})
})