feat(test): add withProviders for per test providers

Closes #5128
This commit is contained in:
Julie Ralph
2015-12-10 12:00:48 -08:00
committed by Matias Niemela
parent c6afea61f1
commit c1a0af514f
2 changed files with 34 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import {
beforeEach,
inject,
injectAsync,
withProviders,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
@ -186,6 +187,13 @@ export function main() {
inject([FancyService], (service) => { expect(service.value).toEqual('async value'); }));
});
});
describe('per test providers', () => {
it('should allow per test providers',
withProviders(() => [bind(FancyService).toValue(new FancyService())])
.inject([FancyService],
(service) => { expect(service.value).toEqual('real value'); }));
});
});
describe('errors', () => {