feat: complete custom day start route

Closes #7363
This commit is contained in:
Blade Barringer
2016-05-20 08:03:14 -05:00
parent 5b7a56d28d
commit 1fb77c0e92
6 changed files with 62 additions and 37 deletions
+3 -11
View File
@@ -17,7 +17,7 @@ describe('Settings Controller', function () {
releasePets: sandbox.stub(),
releaseMounts: sandbox.stub(),
releaseBoth: sandbox.stub(),
setLastCron: sandbox.stub(),
setCustomDayStart: sandbox.stub(),
user: user
};
@@ -87,19 +87,11 @@ describe('Settings Controller', function () {
});
describe('#saveDayStart', function () {
it('updates user\'s custom day start and last cron', function () {
var fakeCurrentTime = new Date(2013, 3, 1, 8, 12).getTime();
var expectedTime = fakeCurrentTime;
sandbox.useFakeTimers(fakeCurrentTime);
it('updates user\'s custom day start', function () {
scope.dayStart = 5;
scope.saveDayStart();
expect(User.set).to.be.calledOnce;
expect(User.set).to.be.calledWith({
'preferences.dayStart': 5,
});
expect(User.setLastCron).to.be.calledWith(expectedTime);
expect(User.setCustomDayStart).to.be.calledWith(5);
});
});