-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy pathload-scenarios.js
26 lines (25 loc) · 1014 Bytes
/
load-scenarios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import Ember from 'ember';
import {requireFiles} from './helper-functions';
const scenarioFileRegExp = new RegExp('/scenarios/main$');
/**
* There is only one scenario file that is important here.
* And that is: scenarios/main.js file.
*
* This file dictates what the scenario will be, since from
* there you can include other scenarios, and compose whatever
* grand scheme you have in mind
*
* @param container
*/
export default function(container) {
let config = container.owner.resolveRegistration('config:environment') || {},
{ factoryGuy } = config;
if (factoryGuy && factoryGuy.useScenarios) {
let [Scenario] = requireFiles(scenarioFileRegExp);
Ember.assert(`[ember-data-factory-guy] No app/scenarios/main.js file was found.
If you have factoryGuy set to true in config/environment.js file,
then you should setup a file app/scenarios/main.js to control what data will
be like in the application.`, Scenario);
(new Scenario['default']()).run();
}
}