aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular-mocks.js
diff options
context:
space:
mode:
authorVojta Jina2012-03-05 19:28:03 -0800
committerVojta Jina2012-03-05 19:28:03 -0800
commit64912069caeb5a05da449b6ee04c965477f3ae25 (patch)
tree46b582b7def008cde6f0331d099fc10de3e59bd3 /src/angular-mocks.js
parentb49ddf9848952a95032e9962796ec3a6e50857de (diff)
downloadangular.js-64912069caeb5a05da449b6ee04c965477f3ae25.tar.bz2
docs(mock.inject): Fix the example
And explicitly say that you need to load your application modules that you wanna test.
Diffstat (limited to 'src/angular-mocks.js')
-rw-r--r--src/angular-mocks.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js
index 625dcf44..93136698 100644
--- a/src/angular-mocks.js
+++ b/src/angular-mocks.js
@@ -1528,35 +1528,36 @@ window.jasmine && (function(window) {
* Example of what a typical jasmine tests looks like with the inject method.
* <pre>
*
- * angular.module('myTestsModule', [], function($provide) {
- * $provide.value('mode', 'test');
- * });
+ * angular.module('myApplicationModule', [])
+ * .value('mode', 'app')
+ * .value('version', 'v1.0.1');
+ *
*
* describe('MyApp', function() {
*
- * // you can list multiple module function or aliases
- * // which will be used in creating the injector
- * beforeEach(module('myTestModule', function($provide) {
- * // $provide service is configured as needed
- * $provide.value('version', 'v1.0.1');
- * });
+ * // You need to load modules that you want to test,
+ * // it loads only the "ng" module by default.
+ * beforeEach(module('myApplicationModule'));
+ *
*
- * // The inject() is used to get references.
+ * // inject() is used to inject arguments of all given functions
* it('should provide a version', inject(function(mode, version) {
* expect(version).toEqual('v1.0.1');
- * expect(mode).toEqual('test');
- * });
+ * expect(mode).toEqual('app');
+ * }));
+ *
*
* // The inject and module method can also be used inside of the it or beforeEach
- * it('should override a version and test the new version is injected', function(){
+ * it('should override a version and test the new version is injected', function() {
+ * // module() takes functions or strings (module aliases)
* module(function($provide) {
* $provide.value('version', 'overridden'); // override version here
* });
+ *
* inject(function(version) {
* expect(version).toEqual('overridden');
* });
* ));
- *
* });
*
* </pre>