Fixes the queue test
This commit is contained in:
parent
e5846e30f9
commit
91b112cb0a
2 changed files with 15 additions and 12 deletions
|
@ -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',
|
.controller('QueueCtrl', ['$scope', '$rootScope', 'globals', 'player',
|
||||||
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, player) {
|
function QueueCtrl($scope, $rootScope, globals, player) {
|
||||||
'use strict';
|
'use strict';
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.song = $rootScope.queue;
|
$scope.song = $rootScope.queue;
|
||||||
|
|
|
@ -1,24 +1,28 @@
|
||||||
describe("Queue controller", function() {
|
describe("Queue controller", function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var player, scope;
|
var player, $rootScope, scope, globals;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
module('jamstash.queue.ctrl');
|
module('jamstash.queue.ctrl');
|
||||||
|
|
||||||
inject(function ($controller, $rootScope, _player_) {
|
inject(function ($controller, _$rootScope_, _globals_, _player_) {
|
||||||
|
$rootScope = _$rootScope_;
|
||||||
scope = $rootScope.$new();
|
scope = $rootScope.$new();
|
||||||
|
globals = _globals_;
|
||||||
player = _player_;
|
player = _player_;
|
||||||
|
|
||||||
// Mock the functions of the services
|
// Mock the functions of the services
|
||||||
spyOn(player, "playSong").and.stub();
|
spyOn(player, "playSong").and.stub();
|
||||||
|
|
||||||
$controller('PlayerCtrl', {
|
$controller('QueueCtrl', {
|
||||||
|
$rootScope: $rootScope,
|
||||||
$scope: scope,
|
$scope: scope,
|
||||||
|
globals: globals,
|
||||||
player: player
|
player: player
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
it("When I call playSong, it calls playSong in the player service", function() {
|
it("When I call playSong, it calls playSong in the player service", function() {
|
||||||
var fakeSong = {"id": 3174};
|
var fakeSong = {"id": 3174};
|
||||||
|
|
||||||
|
@ -27,4 +31,3 @@ describe("Queue controller", function() {
|
||||||
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
|
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue