Fixes the queue test

This commit is contained in:
Hyzual 2014-11-30 19:25:23 +01:00
parent e5846e30f9
commit 91b112cb0a
2 changed files with 15 additions and 12 deletions

View file

@ -1,7 +1,7 @@
angular.module('jamstash.queue.ctrl', [])
angular.module('jamstash.queue.ctrl', ['jamstash.player.service'])
.controller('QueueCtrl', ['$scope', '$rootScope', '$routeParams', '$location', 'utils', 'globals', 'player',
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, player) {
.controller('QueueCtrl', ['$scope', '$rootScope', 'globals', 'player',
function QueueCtrl($scope, $rootScope, globals, player) {
'use strict';
$scope.settings = globals.settings;
$scope.song = $rootScope.queue;

View file

@ -1,30 +1,33 @@
describe("Queue controller", function() {
'use strict';
var player, scope;
var player, $rootScope, scope, globals;
beforeEach(function() {
module('jamstash.queue.ctrl');
inject(function ($controller, $rootScope, _player_) {
inject(function ($controller, _$rootScope_, _globals_, _player_) {
$rootScope = _$rootScope_;
scope = $rootScope.$new();
globals = _globals_;
player = _player_;
// Mock the functions of the services
spyOn(player, "playSong").and.stub();
$controller('PlayerCtrl', {
$controller('QueueCtrl', {
$rootScope: $rootScope,
$scope: scope,
globals: globals,
player: player
});
});
});
it("When I call playSong, it calls playSong in the player service", function() {
var fakeSong = {"id": 3174};
it("When I call playSong, it calls playSong in the player service", function() {
var fakeSong = {"id": 3174};
scope.playSong(true, fakeSong);
scope.playSong(true, fakeSong);
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
});
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
});
});