File tree Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -51,21 +51,18 @@ module.exports = CoreObject.extend({
51
51
var uploadKey = this . _currentKey ( ) ;
52
52
var that = this ;
53
53
54
- return new RSVP . Promise ( function ( resolve , reject ) {
55
- that . _list ( )
56
- . then ( function ( uploads ) {
57
- return uploads . indexOf ( revisionKey ) > - 1 ? resolve ( ) : reject ( ) ;
58
- } )
59
- . then ( function ( ) {
60
- return that . client . set ( uploadKey , revisionKey ) ;
61
- } )
62
- . then ( resolve ) ;
63
- } )
64
- . then ( this . _activationSuccessfulMessage )
65
- . then ( this . _printSuccessMessage . bind ( this ) )
66
- . catch ( function ( ) {
67
- return this . _printErrorMessage ( this . _revisionNotFoundMessage ( ) ) ;
68
- } . bind ( this ) ) ;
54
+ return this . _list ( )
55
+ . then ( function ( uploads ) {
56
+ return uploads . indexOf ( revisionKey ) > - 1 ? RSVP . resolve ( ) : RSVP . reject ( ) ;
57
+ } )
58
+ . then ( function ( ) {
59
+ return that . client . set ( uploadKey , revisionKey ) ;
60
+ } )
61
+ . then ( this . _activationSuccessfulMessage )
62
+ . then ( this . _printSuccessMessage . bind ( this ) )
63
+ . catch ( function ( ) {
64
+ return this . _printErrorMessage ( this . _revisionNotFoundMessage ( ) ) ;
65
+ } . bind ( this ) ) ;
69
66
} ,
70
67
71
68
_list : function ( ) {
Original file line number Diff line number Diff line change @@ -262,6 +262,23 @@ describe('RedisAdapter', function() {
262
262
263
263
return expect ( activation ) . to . be . rejectedWith ( SilentError , / E r r o r ! / ) ;
264
264
} ) ;
265
+
266
+ it ( 'does not set the current revision when key is not in manifest' , function ( ) {
267
+ activation = uploadsDone
268
+ . then ( function ( ) {
269
+ return redisAdapter . activate ( revisionsList [ 0 ] ) ;
270
+ } )
271
+ . then ( function ( ) {
272
+ return redisAdapter . activate ( 'does-not-exist' ) ;
273
+ } ) ;
274
+ return expect ( activation ) . to . be . rejected
275
+ . then ( function ( ) {
276
+ return redisAdapter . _current ( ) ;
277
+ } )
278
+ . then ( function ( currentRevision ) {
279
+ return expect ( currentRevision ) . to . eql ( revisionsList [ 0 ] ) ;
280
+ } ) ;
281
+ } ) ;
265
282
} ) ;
266
283
267
284
describe ( '#_current' , function ( ) {
You can’t perform that action at this time.
0 commit comments