-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
61 lines (45 loc) · 1.22 KB
/
config_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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2020 Pieoneers Software Incorporated. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package client_test
import (
"time"
. "github.com/pieoneers/jsonapi-client-go"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Config", func() {
Describe("NewConfig", func() {
When("configuration is default", func() {
var config Config
baseURL := "http://localhost"
timeout := time.Second * 10
BeforeEach(func() {
config = NewConfig(Config{})
})
It("should use default base URL", func() {
Ω(config.BaseURL).Should(Equal(baseURL))
})
It("should use default timeout", func() {
Ω(config.Timeout).Should(Equal(timeout))
})
})
When("configuration is specified", func() {
var config Config
baseURL := "https://api.pieoneers.com"
timeout := time.Second * 1
BeforeEach(func() {
config = NewConfig(Config{
BaseURL: baseURL,
Timeout: timeout,
})
})
It("should use default base URL", func() {
Ω(config.BaseURL).Should(Equal(baseURL))
})
It("should use default timeout", func() {
Ω(config.Timeout).Should(Equal(timeout))
})
})
})
})