| 2323 | return isSpecRunning() ? workFn() : workFn; |
| 2324 | ///////////////////// |
| 2325 | function workFn() { |
| 2326 | if (currentSpec.$injector) { |
| 2327 | throw new Error('Injector already created, can not register a module!'); |
| 2328 | } else { |
| 2329 | var modules = currentSpec.$modules || (currentSpec.$modules = []); |
| 2330 | angular.forEach(moduleFns, function(module) { |
| 2331 | if (angular.isObject(module) && !angular.isArray(module)) { |
| 2332 | modules.push(function($provide) { |
| 2333 | angular.forEach(module, function(value, key) { |
| 2334 | $provide.value(key, value); |
| 2335 | }); |
| 2336 | }); |
| 2337 | } else { |
| 2338 | modules.push(module); |
| 2339 | } |
| 2340 | }); |
| 2341 | } |
| 2342 | } |
| 2343 | }; |
| 2344 | |
| 2345 | /** |