@@ -86,7 +86,7 @@ layout: ""
86
86
87
87
Context ("Load" , func () {
88
88
It ("should load the Config from an existing file at the default path" , func () {
89
- Expect (afero .WriteFile (s .fs , DefaultPath , []byte (v2File ), os .ModePerm )).To (Succeed ())
89
+ Expect (afero .WriteFile (s .fs , DefaultPath , []byte (commentStr + v2File ), os .ModePerm )).To (Succeed ())
90
90
91
91
Expect (s .Load ()).To (Succeed ())
92
92
Expect (s .fs ).NotTo (BeNil ())
@@ -102,23 +102,23 @@ layout: ""
102
102
})
103
103
104
104
It ("should fail if unable to identify the version of the file at the default path" , func () {
105
- Expect (afero .WriteFile (s .fs , DefaultPath , []byte (unversionedFile ), os .ModePerm )).To (Succeed ())
105
+ Expect (afero .WriteFile (s .fs , DefaultPath , []byte (commentStr + unversionedFile ), os .ModePerm )).To (Succeed ())
106
106
107
107
err := s .Load ()
108
108
Expect (err ).To (HaveOccurred ())
109
109
Expect (errors .As (err , & store.LoadError {})).To (BeTrue ())
110
110
})
111
111
112
112
It ("should fail if unable to create a Config for the version of the file at the default path" , func () {
113
- Expect (afero .WriteFile (s .fs , DefaultPath , []byte (nonexistentVersionFile ), os .ModePerm )).To (Succeed ())
113
+ Expect (afero .WriteFile (s .fs , DefaultPath , []byte (commentStr + nonexistentVersionFile ), os .ModePerm )).To (Succeed ())
114
114
115
115
err := s .Load ()
116
116
Expect (err ).To (HaveOccurred ())
117
117
Expect (errors .As (err , & store.LoadError {})).To (BeTrue ())
118
118
})
119
119
120
120
It ("should fail if unable to unmarshal the file at the default path" , func () {
121
- Expect (afero .WriteFile (s .fs , DefaultPath , []byte (wrongFile ), os .ModePerm )).To (Succeed ())
121
+ Expect (afero .WriteFile (s .fs , DefaultPath , []byte (commentStr + wrongFile ), os .ModePerm )).To (Succeed ())
122
122
123
123
err := s .Load ()
124
124
Expect (err ).To (HaveOccurred ())
@@ -128,7 +128,7 @@ layout: ""
128
128
129
129
Context ("LoadFrom" , func () {
130
130
It ("should load the Config from an existing file from the specified path" , func () {
131
- Expect (afero .WriteFile (s .fs , path , []byte (v2File ), os .ModePerm )).To (Succeed ())
131
+ Expect (afero .WriteFile (s .fs , path , []byte (commentStr + v2File ), os .ModePerm )).To (Succeed ())
132
132
133
133
Expect (s .LoadFrom (path )).To (Succeed ())
134
134
Expect (s .fs ).NotTo (BeNil ())
@@ -144,23 +144,23 @@ layout: ""
144
144
})
145
145
146
146
It ("should fail if unable to identify the version of the file at the specified path" , func () {
147
- Expect (afero .WriteFile (s .fs , path , []byte (unversionedFile ), os .ModePerm )).To (Succeed ())
147
+ Expect (afero .WriteFile (s .fs , path , []byte (commentStr + unversionedFile ), os .ModePerm )).To (Succeed ())
148
148
149
149
err := s .LoadFrom (path )
150
150
Expect (err ).To (HaveOccurred ())
151
151
Expect (errors .As (err , & store.LoadError {})).To (BeTrue ())
152
152
})
153
153
154
154
It ("should fail if unable to create a Config for the version of the file at the specified path" , func () {
155
- Expect (afero .WriteFile (s .fs , path , []byte (nonexistentVersionFile ), os .ModePerm )).To (Succeed ())
155
+ Expect (afero .WriteFile (s .fs , path , []byte (commentStr + nonexistentVersionFile ), os .ModePerm )).To (Succeed ())
156
156
157
157
err := s .LoadFrom (path )
158
158
Expect (err ).To (HaveOccurred ())
159
159
Expect (errors .As (err , & store.LoadError {})).To (BeTrue ())
160
160
})
161
161
162
162
It ("should fail if unable to unmarshal the file at the specified path" , func () {
163
- Expect (afero .WriteFile (s .fs , path , []byte (wrongFile ), os .ModePerm )).To (Succeed ())
163
+ Expect (afero .WriteFile (s .fs , path , []byte (commentStr + wrongFile ), os .ModePerm )).To (Succeed ())
164
164
165
165
err := s .LoadFrom (path )
166
166
Expect (err ).To (HaveOccurred ())
@@ -175,7 +175,7 @@ layout: ""
175
175
176
176
cfgBytes , err := afero .ReadFile (s .fs , DefaultPath )
177
177
Expect (err ).NotTo (HaveOccurred ())
178
- Expect (string (cfgBytes )).To (Equal (v2File ))
178
+ Expect (string (cfgBytes )).To (Equal (commentStr + v2File ))
179
179
})
180
180
181
181
It ("should succeed for a valid config that must not exist" , func () {
@@ -185,7 +185,7 @@ layout: ""
185
185
186
186
cfgBytes , err := afero .ReadFile (s .fs , DefaultPath )
187
187
Expect (err ).NotTo (HaveOccurred ())
188
- Expect (string (cfgBytes )).To (Equal (v2File ))
188
+ Expect (string (cfgBytes )).To (Equal (commentStr + v2File ))
189
189
})
190
190
191
191
It ("should fail for an empty config" , func () {
@@ -212,8 +212,7 @@ layout: ""
212
212
213
213
cfgBytes , err := afero .ReadFile (s .fs , path )
214
214
Expect (err ).NotTo (HaveOccurred ())
215
- Expect (string (cfgBytes )).To (Equal (`version: "2"
216
- ` ))
215
+ Expect (string (cfgBytes )).To (Equal (commentStr + v2File ))
217
216
})
218
217
219
218
It ("should succeed for a valid config that must not exist" , func () {
@@ -223,7 +222,7 @@ layout: ""
223
222
224
223
cfgBytes , err := afero .ReadFile (s .fs , path )
225
224
Expect (err ).NotTo (HaveOccurred ())
226
- Expect (string (cfgBytes )).To (Equal (v2File ))
225
+ Expect (string (cfgBytes )).To (Equal (commentStr + v2File ))
227
226
})
228
227
229
228
It ("should fail for an empty config" , func () {
0 commit comments