Skip to content

Commit

Permalink
Fix specifications regarding the fallback approach
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioborges committed Feb 22, 2016
1 parent 5989948 commit 085fa31
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions spec/jasmine_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('Jasmine', function() {
this.bootedJasmine = {
getEnv: jasmine.createSpy('getEnv').and.returnValue({
addReporter: jasmine.createSpy('addReporter'),
provideFallbackReporter: jasmine.createSpy('provideFallbackReporter'),
execute: jasmine.createSpy('execute'),
throwOnExpectationFailure: jasmine.createSpy('throwOnExpectationFailure'),
randomizeTests: jasmine.createSpy('randomizeTests')
Expand Down Expand Up @@ -60,7 +61,7 @@ describe('Jasmine', function() {
this.testJasmine.configureDefaultReporter(reporterOptions);

expect(Jasmine.ConsoleReporter).toHaveBeenCalledWith(expectedReporterOptions);
expect(this.testJasmine.env.addReporter).toHaveBeenCalledWith({someProperty: 'some value'});
expect(this.testJasmine.env.provideFallbackReporter).toHaveBeenCalledWith({someProperty: 'some value'});
});

it('creates a reporter with a default option if an option is not specified', function() {
Expand All @@ -76,7 +77,7 @@ describe('Jasmine', function() {
};

expect(Jasmine.ConsoleReporter).toHaveBeenCalledWith(expectedReporterOptions);
expect(this.testJasmine.env.addReporter).toHaveBeenCalledWith({someProperty: 'some value'});
expect(this.testJasmine.env.provideFallbackReporter).toHaveBeenCalledWith({someProperty: 'some value'});
});

it('sets the defaultReporterAdded flag', function() {
Expand Down Expand Up @@ -269,15 +270,16 @@ describe('Jasmine', function() {
expect(this.testJasmine.env.execute).toHaveBeenCalled();
});

it('does not add a default reporter if a reporter was already added', function() {
it('adds a default reporter as a fallback reporter', function() {
this.testJasmine.addReporter(new Jasmine.ConsoleReporter({}));

spyOn(this.testJasmine, 'configureDefaultReporter');
//spyOn(this.testJasmine, 'configureDefaultReporter');
spyOn(this.testJasmine, 'loadSpecs');

this.testJasmine.execute();

expect(this.testJasmine.configureDefaultReporter).not.toHaveBeenCalled();
expect(this.testJasmine.env.provideFallbackReporter).toHaveBeenCalled();
expect(this.testJasmine.env.addReporter).toHaveBeenCalled();
expect(this.testJasmine.loadSpecs).toHaveBeenCalled();
expect(this.testJasmine.env.execute).toHaveBeenCalled();
});
Expand Down

0 comments on commit 085fa31

Please sign in to comment.