Sha256: c9f24b11a0de68c57cc94d19820648471191fde47e69cf0e08520f58651333dc

Contents?: true

Size: 1.9 KB

Versions: 25

Compression:

Stored size: 1.9 KB

Contents

describe("jasmine.MultiReporter", function() {
  var multiReporter, fakeReporter1, fakeReporter2;

  beforeEach(function() {
    multiReporter = new jasmine.MultiReporter();
    fakeReporter1 = jasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
    fakeReporter2 = jasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
    multiReporter.addReporter(fakeReporter1);
    multiReporter.addReporter(fakeReporter2);
  });

  it("should support all the method calls that jasmine.Reporter supports", function() {
    var delegate = {};
    multiReporter.addReporter(delegate);

    this.addMatchers({
      toDelegateMethod: function(methodName) {
        delegate[methodName] = jasmine.createSpy(methodName);
        this.actual[methodName]("whatever argument");

        return delegate[methodName].wasCalled && 
               delegate[methodName].mostRecentCall.args.length == 1 && 
               delegate[methodName].mostRecentCall.args[0] == "whatever argument";
      }
    });

    expect(multiReporter).toDelegateMethod('reportRunnerStarting');
    expect(multiReporter).toDelegateMethod('reportRunnerResults');
    expect(multiReporter).toDelegateMethod('reportSuiteResults');
    expect(multiReporter).toDelegateMethod('reportSpecStarting');
    expect(multiReporter).toDelegateMethod('reportSpecResults');
    expect(multiReporter).toDelegateMethod('log');
  });

  it("should delegate to any and all subreporters", function() {
    multiReporter.reportSpecResults('blah', 'foo');
    expect(fakeReporter1.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
    expect(fakeReporter2.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
  });

  it("should quietly skip delegating to any subreporters which lack the given method", function() {
    multiReporter.reportRunnerStarting('blah', 'foo');
    expect(fakeReporter2.reportRunnerStarting).toHaveBeenCalledWith('blah', 'foo');
  });
});

Version data entries

25 entries across 25 versions & 5 rubygems

Version Path
evergreen-1.3.0 lib/jasmine/spec/core/MultiReporterSpec.js
evergreen-1.2.0 lib/jasmine/spec/core/MultiReporterSpec.js
evergreen-1.1.3 lib/jasmine/spec/core/MultiReporterSpec.js
evergreen-1.1.2 lib/jasmine/spec/core/MultiReporterSpec.js
evergreen-1.1.0 lib/jasmine/spec/core/MultiReporterSpec.js
rally-jasmine-core-1.2.0.3 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
evergreen-1.0.1 lib/jasmine/spec/core/MultiReporterSpec.js
rally-jasmine-core-1.2.0.2 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.3.1 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.3.0 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
rally-jasmine-core-1.2.0.1 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
rally-jasmine-core-1.2.0.0 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.2.0 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.2.0.rc3 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.2.0.rc2 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
evergreen-1.0.0 lib/jasmine/spec/core/MultiReporterSpec.js
jasmine-core-1.2.0.rc1 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.1.0 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.1.0.rc4 ./lib/jasmine-core/spec/core/MultiReporterSpec.js
jasmine-core-1.1.0.rc3 ./lib/jasmine-core/spec/core/MultiReporterSpec.js