@@ -95,6 +95,58 @@ describe('redis plugin', function() {
9595 assert . equal ( redisLib . createdClient . options . database , 4 ) ;
9696 } ) ;
9797
98+ describe ( 'handles redis urls appropriately' , function ( ) {
99+ it ( 'handles pre-stripped urls without a username' , function ( ) {
100+
101+ var plugin = subject . createDeployPlugin ( {
102+ name : 'redis'
103+ } ) ;
104+
105+ var redisLib = new FakeRedis ( ) ;
106+
107+ var context = {
108+ ui : mockUi ,
109+ project : stubProject ,
110+ config : {
111+ redis : {
112+ url :
'redis://:[email protected] :6379/4' 113+ }
114+ } ,
115+ _redisLib : redisLib
116+ } ;
117+ plugin . beforeHook ( context ) ;
118+ plugin . configure ( context ) ;
119+ plugin . readConfig ( 'redisDeployClient' ) ;
120+
121+ assert . equal ( redisLib . createdClient . options , 'redis://:[email protected] :6379/4' ) ; 122+ } ) ;
123+
124+ it ( 'strips Redis username from a Heroku url to work with our upstream redis library' , function ( ) {
125+
126+ var plugin = subject . createDeployPlugin ( {
127+ name : 'redis'
128+ } ) ;
129+
130+ var redisLib = new FakeRedis ( ) ;
131+
132+ var context = {
133+ ui : mockUi ,
134+ project : stubProject ,
135+ config : {
136+ redis : {
137+ url :
'redis://username:[email protected] :6379/4' 138+ }
139+ } ,
140+ _redisLib : redisLib
141+ } ;
142+ plugin . beforeHook ( context ) ;
143+ plugin . configure ( context ) ;
144+ plugin . readConfig ( 'redisDeployClient' ) ;
145+
146+ assert . equal ( redisLib . createdClient . options , 'redis://:[email protected] :6379/4' ) ; 147+ } ) ;
148+ } ) ;
149+
98150 describe ( 'resolving port from the pipeline' , function ( ) {
99151 it ( 'uses the config data if it already exists' , function ( ) {
100152 var plugin = subject . createDeployPlugin ( {
0 commit comments