0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fix image upload tests on windows

closes #826
- on windows the fs.exists call had windows style back slashes
- set up the test to cope with either (not the most elegant but works)
This commit is contained in:
jamesbloomer 2013-09-21 15:35:15 +01:00 committed by Hannah Wolfe
parent 3098e9577b
commit 55048d6a20

View file

@ -119,6 +119,11 @@ describe('Admin Controller', function() {
fs.exists.withArgs('content/images/2013/Sep/IMAGE.jpg').yields(true);
fs.exists.withArgs('content/images/2013/Sep/IMAGE-1.jpg').yields(false);
// if on windows need to setup with back slashes
// doesn't hurt for the test to cope with both
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE.jpg').yields(true);
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE-1.jpg').yields(false);
sinon.stub(res, 'send', function(data) {
data.should.equal('/content/images/2013/Sep/IMAGE-1.jpg');
return done();
@ -136,6 +141,13 @@ describe('Admin Controller', function() {
fs.exists.withArgs('content/images/2013/Sep/IMAGE-3.jpg').yields(true);
fs.exists.withArgs('content/images/2013/Sep/IMAGE-4.jpg').yields(false);
// windows setup
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE.jpg').yields(true);
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE-1.jpg').yields(true);
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE-2.jpg').yields(true);
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE-3.jpg').yields(true);
fs.exists.withArgs('content\\images\\2013\\Sep\\IMAGE-4.jpg').yields(false);
sinon.stub(res, 'send', function(data) {
data.should.equal('/content/images/2013/Sep/IMAGE-4.jpg');
return done();