mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 23:42:12 +00:00
Convert methods to use sandbox
This commit is contained in:
parent
1ff597e944
commit
8c66714e5f
1 changed files with 10 additions and 10 deletions
|
|
@ -8,7 +8,7 @@ describe("Party Controller", function() {
|
|||
user._id = "unique-user-id";
|
||||
User = {
|
||||
user: user,
|
||||
sync: sinon.spy
|
||||
sync: sandbox.spy
|
||||
}
|
||||
|
||||
module(function($provide) {
|
||||
|
|
@ -35,7 +35,7 @@ describe("Party Controller", function() {
|
|||
describe('questAccept', function() {
|
||||
it('calls Groups.questAccept', function() {
|
||||
var party = {};
|
||||
var groupSpy = sinon.stub(groups, "questAccept", function(){return true;});
|
||||
var groupSpy = sandbox.stub(groups, "questAccept", function(){return true;});
|
||||
scope.questAccept(party);
|
||||
groupSpy.should.have.been.calledOnce;
|
||||
});
|
||||
|
|
@ -44,7 +44,7 @@ describe("Party Controller", function() {
|
|||
describe('questReject', function() {
|
||||
it('calls Groups.questReject', function() {
|
||||
var party = {};
|
||||
var groupSpy = sinon.stub(groups, "questReject", function(){return true;});
|
||||
var groupSpy = sandbox.stub(groups, "questReject", function(){return true;});
|
||||
scope.questReject(party);
|
||||
groupSpy.should.have.been.calledOnce;
|
||||
});
|
||||
|
|
@ -54,7 +54,7 @@ describe("Party Controller", function() {
|
|||
var party, cancelSpy, windowSpy;
|
||||
beforeEach(function() {
|
||||
party = {};
|
||||
cancelSpy = sinon.stub(groups, "questCancel", function(){return true;});
|
||||
cancelSpy = sandbox.stub(groups, "questCancel", function(){return true;});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
@ -63,7 +63,7 @@ describe("Party Controller", function() {
|
|||
});
|
||||
|
||||
it('calls Groups.questCancel when alert box is confirmed', function() {
|
||||
windowSpy = sinon.stub(window, "confirm", function(){return true});
|
||||
windowSpy = sandbox.stub(window, "confirm", function(){return true});
|
||||
|
||||
scope.questCancel(party);
|
||||
windowSpy.should.have.been.calledOnce;
|
||||
|
|
@ -72,7 +72,7 @@ describe("Party Controller", function() {
|
|||
});
|
||||
|
||||
it('does not call Groups.questCancel when alert box is confirmed', function() {
|
||||
windowSpy = sinon.stub(window, "confirm", function(){return false});
|
||||
windowSpy = sandbox.stub(window, "confirm", function(){return false});
|
||||
|
||||
scope.questCancel(party);
|
||||
windowSpy.should.have.been.calledOnce;
|
||||
|
|
@ -84,7 +84,7 @@ describe("Party Controller", function() {
|
|||
var party, abortSpy, windowSpy;
|
||||
beforeEach(function() {
|
||||
party = {};
|
||||
abortSpy = sinon.stub(groups, "questAbort", function(){return true;});
|
||||
abortSpy = sandbox.stub(groups, "questAbort", function(){return true;});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
@ -93,7 +93,7 @@ describe("Party Controller", function() {
|
|||
});
|
||||
|
||||
it('calls Groups.questAbort when two alert boxes are confirmed', function() {
|
||||
windowSpy = sinon.stub(window, "confirm", function(){return true});
|
||||
windowSpy = sandbox.stub(window, "confirm", function(){return true});
|
||||
|
||||
scope.questAbort(party);
|
||||
windowSpy.should.have.been.calledTwice;
|
||||
|
|
@ -103,7 +103,7 @@ describe("Party Controller", function() {
|
|||
});
|
||||
|
||||
it('does not call Groups.questAbort when first alert box is not confirmed', function() {
|
||||
windowSpy = sinon.stub(window, "confirm", function(){return false});
|
||||
windowSpy = sandbox.stub(window, "confirm", function(){return false});
|
||||
|
||||
scope.questAbort(party);
|
||||
windowSpy.should.have.been.calledOnce;
|
||||
|
|
@ -115,7 +115,7 @@ describe("Party Controller", function() {
|
|||
it('does not call Groups.questAbort when first alert box is confirmed but second one is not', function() {
|
||||
// Hack to confirm first window, but not second
|
||||
var shouldReturn = false;
|
||||
windowSpy = sinon.stub(window, "confirm", function(){
|
||||
windowSpy = sandbox.stub(window, "confirm", function(){
|
||||
shouldReturn = !shouldReturn;
|
||||
return shouldReturn;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue