Sha256: d3bf0d488e3bfec8fb0464c197254473eafec0e9bb07664d7f7deee74ac1164b
Contents?: true
Size: 1.28 KB
Versions: 57
Compression:
Stored size: 1.28 KB
Contents
describe("ReportDispatcher", function() { it("builds an interface of requested methods", function() { var dispatcher = new j$.ReportDispatcher(['foo', 'bar', 'baz']); expect(dispatcher.foo).toBeDefined(); expect(dispatcher.bar).toBeDefined(); expect(dispatcher.baz).toBeDefined(); }); it("dispatches requested methods to added reporters", function() { var dispatcher = new j$.ReportDispatcher(['foo', 'bar']), reporter = jasmine.createSpyObj('reporter', ['foo', 'bar']), anotherReporter = jasmine.createSpyObj('reporter', ['foo', 'bar']); dispatcher.addReporter(reporter); dispatcher.addReporter(anotherReporter); dispatcher.foo(123, 456); expect(reporter.foo).toHaveBeenCalledWith(123, 456); expect(anotherReporter.foo).toHaveBeenCalledWith(123, 456); dispatcher.bar('a', 'b'); expect(reporter.bar).toHaveBeenCalledWith('a', 'b'); expect(anotherReporter.bar).toHaveBeenCalledWith('a', 'b'); }); it("does not dispatch to a reporter if the reporter doesn't accept the method", function() { var dispatcher = new j$.ReportDispatcher(['foo']), reporter = jasmine.createSpyObj('reporter', ['baz']); dispatcher.addReporter(reporter); expect(function() { dispatcher.foo(123, 456); }).not.toThrow(); }); });
Version data entries
57 entries across 57 versions & 4 rubygems