spec/javascripts/faye-authentication_spec.js in faye-authentication-1.11.0 vs spec/javascripts/faye-authentication_spec.js in faye-authentication-1.12
- old
+ new
@@ -25,12 +25,12 @@
});
describe('authentication_required', function() {
beforeEach(function() {
+ Faye.logger = {error: function() {}};
this.auth = new FayeAuthentication(new Faye.Client('http://example.com'));
- Faye.logger = null;
});
function sharedExamplesForSubscribeAndPublish() {
it('returns true if no options is passed', function() {
expect(this.auth.authentication_required(this.message)).toBe(true);
@@ -43,10 +43,9 @@
expect(this.auth._options.whitelist).toHaveBeenCalledWith(this.message.subscription || this.message.channel);
});
it('logs error if the function throws', function() {
this.auth._options.whitelist = function(message) { throw new Error("boom"); }
- Faye.logger = {error: function() {}};
spyOn(Faye.logger, 'error');
this.auth.authentication_required(this.message);
expect(Faye.logger.error).toHaveBeenCalledWith('[Faye] Error caught when evaluating whitelist function : boom');
});