title: Expected spy navigate to have been called with [ [ 'users' ] ] but it was never called in integration testing angular CLI
body: <p>I implemented a simple integration test on a project but it failed because expect () line is executed before component.save() method. When I put the expect() line on a setTimeout() it is succeed. How to be succeed without setTimeout()? </p>
  
  <p>spec.ts</p>
  
  <pre><code> import { Observable } from 'rxjs/Rx';
   import { async, ComponentFixture, TestBed } from '@angular/core/testing';
   import { By } from '@angular/platform-browser'; 
   import { DebugElement } from '@angular/core';
   import { Router, ActivatedRoute } from '@angular/Router';
   import { UserDetailsComponent } from './user-details.component';
   import { RouterTestingModule } from '@angular/router/testing';
  
   class RouterStub {
   navigate(params) { };
   }
   class ActivatedRouteStub {
   params: Observable&lt;any&gt; = Observable.empty();
   }
   describe('UserDetailsComponent', () =&gt; {
   let component: UserDetailsComponent;
   let fixture: ComponentFixture&lt;UserDetailsComponent&gt;;
  
   beforeEach(async(() =&gt; {
    TestBed.configureTestingModule({
    imports: [RouterTestingModule],
     declarations: [UserDetailsComponent],
     providers: [
       { provide: Router, useClass: RouterStub },
       { provide: ActivatedRoute, useClass: ActivatedRouteStub }
     ],
   })
     .compileComponents();
  }));
  
  beforeEach(() =&gt; {
   fixture = TestBed.createComponent(UserDetailsComponent);
   component = fixture.componentInstance;
  });
  
  it('should redirect the user to the users page after saving', () =&gt; {
  let router = TestBed.get(Router);
  let spy = spyOn(router, 'navigate');
  
  component.save();
  
  expect(spy).toHaveBeenCalledWith(['users']);
  
   });
  });
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>Expected spy navigate to have been called with [ [ 'users' ] ] but it was never called
  </code></pre>