Fixed more tests

This commit is contained in:
Keith Holliday
2016-05-10 14:13:05 -05:00
parent 632a1ebbf3
commit 4e41028ddd
6 changed files with 37 additions and 27 deletions

View File

@@ -12,6 +12,11 @@ describe('Settings Controller', function () {
user = specHelper.newUser();
User = {
set: sandbox.stub(),
reroll: sandbox.stub(),
rebirth: sandbox.stub(),
releasePets: sandbox.stub(),
releaseMounts: sandbox.stub(),
releaseBoth: sandbox.stub(),
user: user
};
@@ -123,7 +128,7 @@ describe('Settings Controller', function () {
scope.reroll(true);
expect(user.ops.reroll).to.be.calledWith({});
expect(User.reroll).to.be.calledWith({});
});
it('navigates to the tasks page when confirmed', function () {
@@ -173,7 +178,7 @@ describe('Settings Controller', function () {
scope.rebirth(true);
expect(user.ops.rebirth).to.be.calledWith({});
expect(User.rebirth).to.be.calledWith({});
});
it('navigates to tasks page when confirmed', function () {
@@ -216,9 +221,9 @@ describe('Settings Controller', function () {
it('doesn\'t call any release method if type is not provided', function () {
scope.releaseAnimals();
expect(User.user.ops.releasePets).to.not.be.called;
expect(User.user.ops.releaseMounts).to.not.be.called;
expect(User.user.ops.releaseBoth).to.not.be.called;
expect(User.releasePets).to.not.be.called;
expect(User.releaseMounts).to.not.be.called;
expect(User.releaseBoth).to.not.be.called;
});
it('doesn\'t redirect to tasks page if type is not provided', function () {
@@ -230,7 +235,7 @@ describe('Settings Controller', function () {
it('calls releasePets when "pets" is provided', function () {
scope.releaseAnimals('pets');
expect(User.user.ops.releasePets).to.be.calledOnce;
expect(User.releasePets).to.be.calledOnce;
});
it('navigates to the tasks page when "pets" is provided', function () {
@@ -242,7 +247,7 @@ describe('Settings Controller', function () {
it('calls releaseMounts when "mounts" is provided', function () {
scope.releaseAnimals('mounts');
expect(User.user.ops.releaseMounts).to.be.calledOnce;
expect(User.releaseMounts).to.be.calledOnce;
});
it('navigates to the tasks page when "mounts" is provided', function () {
@@ -254,7 +259,7 @@ describe('Settings Controller', function () {
it('calls releaseBoth when "both" is provided', function () {
scope.releaseAnimals('both');
expect(User.user.ops.releaseBoth).to.be.calledOnce;
expect(User.releaseBoth).to.be.calledOnce;
});
it('navigates to the tasks page when "both" is provided', function () {
@@ -266,9 +271,9 @@ describe('Settings Controller', function () {
it('does not call release functions when non-applicable argument is passed in', function () {
scope.releaseAnimals('dummy');
expect(User.user.ops.releasePets).to.not.be.called;
expect(User.user.ops.releaseMounts).to.not.be.called;
expect(User.user.ops.releaseBoth).to.not.be.called;
expect(User.releasePets).to.not.be.called;
expect(User.releaseMounts).to.not.be.called;
expect(User.releaseBoth).to.not.be.called;
});
});