Skip to content

Commit

Permalink
added test for startPhotoSession
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanjudis committed Jan 16, 2014
1 parent 1e3b62b commit cdfc8f0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tasks/lib/photobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ PhotoBox.prototype.setPictureCount = function( count ) {

/**
* Start a session of taking pictures
*
* @tested
*/
PhotoBox.prototype.startPhotoSession = function() {
this.grunt.log.subhead( 'PHOTOBOX STARTED PHOTO SESSION.' );
Expand Down
43 changes: 43 additions & 0 deletions test/lib/photoboxTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,49 @@ exports.photoBox = {
},


startPhotoSession : function( test ) {
var options = {
indexPath : 'tmp',
template : 'canvas',
screenSizes : [ '1000', '1200' ],
urls : [ 'http://google.com', 'http://4waisenkinder.de' ]
},
pb = new Photobox( grunt, options ),
spawn = grunt.util.spawn,
count = 0;

grunt.util.spawn = function() {
count++;

test.strictEqual( typeof arguments[ 0 ], 'object' );
test.ok( arguments[ 0 ].cmd.match( /phantom/gi ) );
test.strictEqual( arguments[ 0 ].args instanceof Array, true );
test.strictEqual( arguments[ 0 ].args.length, 4 );
test.strictEqual( typeof arguments[ 0 ].opts, 'object' );

test.strictEqual( typeof arguments[ 1 ], 'function' );

if ( count === 4 ) {
test.strictEqual(
grunt.file.exists( 'tmp/img/current/timestamp.json' ),
true
);

test.strictEqual(
grunt.file.exists( 'tmp/options.json' ),
true
);

test.done();
}
};

pb.startPhotoSession();

grunt.util.spawn = spawn;
},


tookPictureHandler : {
canvasMode : function( test ) {
var cbFunction = function() {
Expand Down

0 comments on commit cdfc8f0

Please sign in to comment.