@@ -158,9 +158,15 @@ describe('Unit: Tasks > Migrator', function () {
158
158
} ) ;
159
159
160
160
describe ( 'rollback' , function ( ) {
161
+ let cliConfig ;
162
+
163
+ beforeEach ( function ( ) {
164
+ cliConfig = configStub ( ) ;
165
+ cliConfig . get . withArgs ( 'active-version' ) . returns ( '1.25.3' ) ;
166
+ } ) ;
167
+
161
168
it ( 'runs direct command if useGhostUser returns false' , function ( ) {
162
169
const config = configStub ( ) ;
163
- const cliConfig = configStub ( ) ;
164
170
const execaStub = sinon . stub ( ) . resolves ( ) ;
165
171
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
166
172
@@ -181,7 +187,7 @@ describe('Unit: Tasks > Migrator', function () {
181
187
} ) ;
182
188
} ) ;
183
189
184
- it ( 'forward version option to knex-migrator if blog is on v1' , function ( ) {
190
+ it ( 'forward version option to knex-migrator if blog jumps from v1 to v2 ' , function ( ) {
185
191
const config = configStub ( ) ;
186
192
const cliConfig = configStub ( ) ;
187
193
const execaStub = sinon . stub ( ) . resolves ( ) ;
@@ -209,7 +215,6 @@ describe('Unit: Tasks > Migrator', function () {
209
215
210
216
it ( 'runs sudo command if useGhostUser returns true' , function ( ) {
211
217
const config = configStub ( ) ;
212
- const cliConfig = configStub ( ) ;
213
218
const execaStub = sinon . stub ( ) . resolves ( ) ;
214
219
const useGhostUserStub = sinon . stub ( ) . returns ( true ) ;
215
220
@@ -230,7 +235,6 @@ describe('Unit: Tasks > Migrator', function () {
230
235
231
236
it ( 'throws config error with db host if database not found' , function ( ) {
232
237
const config = configStub ( ) ;
233
- const cliConfig = configStub ( ) ;
234
238
const execaStub = sinon . stub ( ) . returns ( Promise . reject ( { stderr : 'CODE: ENOTFOUND' } ) ) ;
235
239
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
236
240
@@ -249,7 +253,6 @@ describe('Unit: Tasks > Migrator', function () {
249
253
250
254
it ( 'throws config error with db user if access denied error' , function ( ) {
251
255
const config = configStub ( ) ;
252
- const cliConfig = configStub ( ) ;
253
256
const execaStub = sinon . stub ( ) . returns ( Promise . reject ( { stderr : 'CODE: ER_ACCESS_DENIED_ERROR' } ) ) ;
254
257
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
255
258
@@ -268,7 +271,6 @@ describe('Unit: Tasks > Migrator', function () {
268
271
269
272
it ( 'throws system error if sqlite3 error is thrown by knex' , function ( ) {
270
273
const config = configStub ( ) ;
271
- const cliConfig = configStub ( ) ;
272
274
const execaStub = sinon . stub ( ) . returns ( Promise . reject ( { stdout : 'Knex: run\n$ npm install sqlite3 --save\nError:' } ) ) ;
273
275
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
274
276
@@ -287,7 +289,6 @@ describe('Unit: Tasks > Migrator', function () {
287
289
288
290
it ( 'knex-migrator complains that no more migrations to rollback available' , function ( ) {
289
291
const config = configStub ( ) ;
290
- const cliConfig = configStub ( ) ;
291
292
const execaStub = sinon . stub ( ) . returns ( Promise . reject ( { stderr : 'No migrations available to rollback' } ) ) ;
292
293
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
293
294
@@ -305,7 +306,6 @@ describe('Unit: Tasks > Migrator', function () {
305
306
process . argv = [ 'node' , 'ghost' , 'update' , '--rollback' ] ;
306
307
307
308
const config = configStub ( ) ;
308
- const cliConfig = configStub ( ) ;
309
309
const execaStub = sinon . stub ( ) . rejects ( { stderr : 'YA_GOOFED' } ) ;
310
310
const useGhostUserStub = sinon . stub ( ) . returns ( false ) ;
311
311
0 commit comments