@@ -36,7 +36,7 @@ var _ = Describe("Config", func() {
36
36
It ("should save correctly" , func () {
37
37
38
38
By ("saving empty config" )
39
- Expect (cfg .Save ()).To ( HaveOccurred ())
39
+ Expect (cfg .Save ()).NotTo ( Succeed ())
40
40
41
41
By ("saving empty config with path" )
42
42
cfg = Config {
@@ -89,7 +89,7 @@ version: "2"
89
89
}
90
90
expectedConfigStr = `domain: example.com
91
91
repo: github.com/example/project
92
- version: " 3-alpha"
92
+ version: 3-alpha
93
93
plugins:
94
94
plugin-x:
95
95
data-1: single plugin datum
@@ -108,12 +108,13 @@ plugins:
108
108
109
109
It ("should load correctly" , func () {
110
110
var (
111
- fs = afero .NewMemMapFs ()
111
+ fs afero.Fs
112
112
configStr string
113
113
expectedConfig config.Config
114
114
)
115
115
116
116
By ("loading config version 2" )
117
+ fs = afero .NewMemMapFs ()
117
118
configStr = `domain: example.com
118
119
repo: github.com/example/project
119
120
version: "2"`
@@ -122,17 +123,16 @@ version: "2"`
122
123
Repo : "github.com/example/project" ,
123
124
Domain : "example.com" ,
124
125
}
125
- err := afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )
126
- Expect (err ).ToNot (HaveOccurred ())
126
+ Expect (afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )).To (Succeed ())
127
127
cfg , err := readFrom (fs , DefaultPath )
128
128
Expect (err ).NotTo (HaveOccurred ())
129
- Expect (cfg ).To (BeEquivalentTo (expectedConfig ))
129
+ Expect (cfg ).To (Equal (expectedConfig ))
130
130
131
131
By ("loading config version 3-alpha with plugin config" )
132
132
fs = afero .NewMemMapFs ()
133
133
configStr = `domain: example.com
134
134
repo: github.com/example/project
135
- version: " 3-alpha"
135
+ version: 3-alpha
136
136
plugins:
137
137
plugin-x:
138
138
data-1: single plugin datum
@@ -143,7 +143,7 @@ plugins:
143
143
- "plugin value 3"
144
144
- "plugin value 4"`
145
145
expectedConfig = config.Config {
146
- Version : config .Version2 ,
146
+ Version : config .Version3Alpha ,
147
147
Repo : "github.com/example/project" ,
148
148
Domain : "example.com" ,
149
149
Plugins : config.PluginConfigs {
@@ -157,8 +157,7 @@ plugins:
157
157
},
158
158
},
159
159
}
160
- err = afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )
161
- Expect (err ).ToNot (HaveOccurred ())
160
+ Expect (afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )).To (Succeed ())
162
161
cfg , err = readFrom (fs , DefaultPath )
163
162
Expect (err ).NotTo (HaveOccurred ())
164
163
Expect (cfg ).To (Equal (expectedConfig ))
@@ -186,22 +185,16 @@ plugins:
186
185
})
187
186
188
187
It ("should return a load error" , func () {
189
- var (
190
- fs afero.Fs
191
- configStr string
192
- err error
193
- )
194
188
By ("loading config version 2 with plugin config" )
195
- fs = afero .NewMemMapFs ()
196
- configStr = `domain: example.com
189
+ fs : = afero .NewMemMapFs ()
190
+ configStr : = `domain: example.com
197
191
repo: github.com/example/project
198
- version: "3-alpha "
192
+ version: "2 "
199
193
plugins:
200
194
plugin-x:
201
195
data-1: single plugin datum`
202
- err = afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )
203
- Expect (err ).ToNot (HaveOccurred ())
204
- _ , err = readFrom (fs , DefaultPath )
196
+ Expect (afero .WriteFile (fs , DefaultPath , []byte (configStr ), os .ModePerm )).To (Succeed ())
197
+ _ , err := readFrom (fs , DefaultPath )
205
198
Expect (err ).To (HaveOccurred ())
206
199
})
207
200
})
0 commit comments