Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Advise user to shutdown pretender servers #925

Merged
merged 1 commit into from
Oct 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions docs/v0.2.x/manually-starting-mirage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@ version: v0.2.x

Currently, Mirage's server boots up in an Ember initializer. This means it will not automatically start in unit or integration tests, since there's no Ember app running.

Eventually we'll extract Mirage's initializer, but for now you can use this workaround. To run your Mirage server during a unit or integration test, first create a helper:

```js
// tests/helpers/setup-mirage-for-integration.js
import mirageInitializer from '../../initializers/ember-cli-mirage';

export default function startMirage(container) {
mirageInitializer.initialize(container);
}
```

Then, add the following to any test where you want Mirage to initialize:
Eventually we'll extract Mirage's initializer, but for now you can use this workaround. Add the following to any test where you want Mirage to initialize:

```js
// tests/integration/components/your-test.js
import startMirage from '../../../helpers/setup-mirage-for-integration';
import { startMirage } from 'yourapp/initializers/ember-cli-mirage';

moduleForComponent('your-component', 'Integration | Component | your component', {
integration: true,
setup() {
startMirage(this.container);
beforeEach() {
this.server = startMirage();
},
afterEach() {
this.server.shutdown();
}
});
```