angular_velocity 0.0.6alpha → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.13'
3
+ #gem 'rails', '4.0.0'
4
4
  gem 'rspec'
5
5
  #needed to use testunit generator cases with rspec
6
6
  gem "generator_spec"
@@ -1,3 +1,3 @@
1
1
  module AngularVelocity
2
- VERSION = "0.0.6alpha"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.5
2
+ * @license AngularJS v1.0.8
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
@@ -24,6 +24,17 @@ angular.module('ngCookies', ['ng']).
24
24
  * Only a simple Object is exposed and by adding or removing properties to/from
25
25
  * this object, new cookies are created/deleted at the end of current $eval.
26
26
  *
27
+ * # Installation
28
+ * To use $cookies make sure you have included the `angular-cookies.js` that comes in Angular
29
+ * package. You can also find this file on Google CDN, bower as well as at
30
+ * {@link http://code.angularjs.org/ code.angularjs.org}.
31
+ *
32
+ * Finally load the module in your application:
33
+ *
34
+ * angular.module('app', ['ngCookies']);
35
+ *
36
+ * and you are ready to get started!
37
+ *
27
38
  * @example
28
39
  <doc:example>
29
40
  <doc:source>
@@ -145,7 +156,8 @@ angular.module('ngCookies', ['ng']).
145
156
  * @returns {Object} Deserialized cookie value.
146
157
  */
147
158
  get: function(key) {
148
- return angular.fromJson($cookies[key]);
159
+ var value = $cookies[key];
160
+ return value ? angular.fromJson(value) : value;
149
161
  },
150
162
 
151
163
  /**
@@ -180,4 +192,5 @@ angular.module('ngCookies', ['ng']).
180
192
 
181
193
  }]);
182
194
 
183
- })(window, window.angular);
195
+
196
+ })(window, window.angular);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license AngularJS v1.0.5
2
+ * @license AngularJS v1.0.8
3
3
  * (c) 2010-2012 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  *
@@ -29,7 +29,7 @@ angular.mock = {};
29
29
  * that there are several helper methods available which can be used in tests.
30
30
  */
31
31
  angular.mock.$BrowserProvider = function() {
32
- this.$get = function(){
32
+ this.$get = function() {
33
33
  return new angular.mock.$Browser();
34
34
  };
35
35
  };
@@ -241,10 +241,10 @@ angular.mock.$ExceptionHandlerProvider = function() {
241
241
  *
242
242
  * @param {string} mode Mode of operation, defaults to `rethrow`.
243
243
  *
244
- * - `rethrow`: If any errors are are passed into the handler in tests, it typically
244
+ * - `rethrow`: If any errors are passed into the handler in tests, it typically
245
245
  * means that there is a bug in the application or test, so this mock will
246
246
  * make these tests fail.
247
- * - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores an
247
+ * - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log` mode stores an
248
248
  * array of errors in `$exceptionHandler.errors`, to allow later assertion of them.
249
249
  * See {@link ngMock.$log#assertEmpty assertEmpty()} and
250
250
  * {@link ngMock.$log#reset reset()}
@@ -322,7 +322,13 @@ angular.mock.$LogProvider = function() {
322
322
  * @propertyOf ngMock.$log
323
323
  *
324
324
  * @description
325
- * Array of logged messages.
325
+ * Array of messages logged using {@link ngMock.$log#log}.
326
+ *
327
+ * @example
328
+ * <pre>
329
+ * $log.log('Some Log');
330
+ * var first = $log.log.logs.unshift();
331
+ * </pre>
326
332
  */
327
333
  $log.log.logs = [];
328
334
  /**
@@ -331,7 +337,13 @@ angular.mock.$LogProvider = function() {
331
337
  * @propertyOf ngMock.$log
332
338
  *
333
339
  * @description
334
- * Array of logged messages.
340
+ * Array of messages logged using {@link ngMock.$log#warn}.
341
+ *
342
+ * @example
343
+ * <pre>
344
+ * $log.warn('Some Warning');
345
+ * var first = $log.warn.logs.unshift();
346
+ * </pre>
335
347
  */
336
348
  $log.warn.logs = [];
337
349
  /**
@@ -340,7 +352,13 @@ angular.mock.$LogProvider = function() {
340
352
  * @propertyOf ngMock.$log
341
353
  *
342
354
  * @description
343
- * Array of logged messages.
355
+ * Array of messages logged using {@link ngMock.$log#info}.
356
+ *
357
+ * @example
358
+ * <pre>
359
+ * $log.info('Some Info');
360
+ * var first = $log.info.logs.unshift();
361
+ * </pre>
344
362
  */
345
363
  $log.info.logs = [];
346
364
  /**
@@ -349,7 +367,13 @@ angular.mock.$LogProvider = function() {
349
367
  * @propertyOf ngMock.$log
350
368
  *
351
369
  * @description
352
- * Array of logged messages.
370
+ * Array of messages logged using {@link ngMock.$log#error}.
371
+ *
372
+ * @example
373
+ * <pre>
374
+ * $log.log('Some Error');
375
+ * var first = $log.error.logs.unshift();
376
+ * </pre>
353
377
  */
354
378
  $log.error.logs = [];
355
379
  };
@@ -388,7 +412,7 @@ angular.mock.$LogProvider = function() {
388
412
  (function() {
389
413
  var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
390
414
 
391
- function jsonStringToDate(string){
415
+ function jsonStringToDate(string) {
392
416
  var match;
393
417
  if (match = string.match(R_ISO8061_STR)) {
394
418
  var date = new Date(0),
@@ -430,7 +454,7 @@ angular.mock.$LogProvider = function() {
430
454
  *
431
455
  * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
432
456
  *
433
- * Mock of the Date type which has its timezone specified via constroctor arg.
457
+ * Mock of the Date type which has its timezone specified via constructor arg.
434
458
  *
435
459
  * The main purpose is to create Date-like instances with timezone fixed to the specified timezone
436
460
  * offset, so that we can test code that depends on local timezone settings without dependency on
@@ -653,14 +677,14 @@ angular.mock.dump = function(object) {
653
677
  * @ngdoc object
654
678
  * @name ngMock.$httpBackend
655
679
  * @description
656
- * Fake HTTP backend implementation suitable for unit testing application that use the
680
+ * Fake HTTP backend implementation suitable for unit testing applications that use the
657
681
  * {@link ng.$http $http service}.
658
682
  *
659
- * *Note*: For fake http backend implementation suitable for end-to-end testing or backend-less
683
+ * *Note*: For fake HTTP backend implementation suitable for end-to-end testing or backend-less
660
684
  * development please see {@link ngMockE2E.$httpBackend e2e $httpBackend mock}.
661
685
  *
662
686
  * During unit testing, we want our unit tests to run quickly and have no external dependencies so
663
- * we dont want to send {@link https://developer.mozilla.org/en/xmlhttprequest XHR} or
687
+ * we don’t want to send {@link https://developer.mozilla.org/en/xmlhttprequest XHR} or
664
688
  * {@link http://en.wikipedia.org/wiki/JSONP JSONP} requests to a real server. All we really need is
665
689
  * to verify whether a certain request has been sent or not, or alternatively just let the
666
690
  * application make requests, respond with pre-trained responses and assert that the end result is
@@ -749,75 +773,100 @@ angular.mock.dump = function(object) {
749
773
  *
750
774
  *
751
775
  * # Unit testing with mock $httpBackend
776
+ * The following code shows how to setup and use the mock backend in unit testing a controller.
777
+ * First we create the controller under test
752
778
  *
753
- * <pre>
754
- // controller
755
- function MyController($scope, $http) {
756
- $http.get('/auth.py').success(function(data) {
757
- $scope.user = data;
758
- });
759
-
760
- this.saveMessage = function(message) {
761
- $scope.status = 'Saving...';
762
- $http.post('/add-msg.py', message).success(function(response) {
763
- $scope.status = '';
764
- }).error(function() {
765
- $scope.status = 'ERROR!';
766
- });
767
- };
768
- }
779
+ <pre>
780
+ // The controller code
781
+ function MyController($scope, $http) {
782
+ var authToken;
769
783
 
770
- // testing controller
771
- var $httpBackend;
784
+ $http.get('/auth.py').success(function(data, status, headers) {
785
+ authToken = headers('A-Token');
786
+ $scope.user = data;
787
+ });
772
788
 
773
- beforeEach(inject(function($injector) {
774
- $httpBackend = $injector.get('$httpBackend');
789
+ $scope.saveMessage = function(message) {
790
+ var headers = { 'Authorization': authToken };
791
+ $scope.status = 'Saving...';
775
792
 
776
- // backend definition common for all tests
777
- $httpBackend.when('GET', '/auth.py').respond({userId: 'userX'}, {'A-Token': 'xxx'});
778
- }));
793
+ $http.post('/add-msg.py', message, { headers: headers } ).success(function(response) {
794
+ $scope.status = '';
795
+ }).error(function() {
796
+ $scope.status = 'ERROR!';
797
+ });
798
+ };
799
+ }
800
+ </pre>
801
+ *
802
+ * Now we setup the mock backend and create the test specs.
803
+ *
804
+ <pre>
805
+ // testing controller
806
+ describe('MyController', function() {
807
+ var $httpBackend, $rootScope, createController;
779
808
 
809
+ beforeEach(inject(function($injector) {
810
+ // Set up the mock http service responses
811
+ $httpBackend = $injector.get('$httpBackend');
812
+ // backend definition common for all tests
813
+ $httpBackend.when('GET', '/auth.py').respond({userId: 'userX'}, {'A-Token': 'xxx'});
780
814
 
781
- afterEach(function() {
782
- $httpBackend.verifyNoOutstandingExpectation();
783
- $httpBackend.verifyNoOutstandingRequest();
784
- });
815
+ // Get hold of a scope (i.e. the root scope)
816
+ $rootScope = $injector.get('$rootScope');
817
+ // The $controller service is used to create instances of controllers
818
+ var $controller = $injector.get('$controller');
785
819
 
820
+ createController = function() {
821
+ return $controller('MyController', {'$scope' : $rootScope });
822
+ };
823
+ }));
786
824
 
787
- it('should fetch authentication token', function() {
788
- $httpBackend.expectGET('/auth.py');
789
- var controller = scope.$new(MyController);
790
- $httpBackend.flush();
791
- });
825
+
826
+ afterEach(function() {
827
+ $httpBackend.verifyNoOutstandingExpectation();
828
+ $httpBackend.verifyNoOutstandingRequest();
829
+ });
792
830
 
793
831
 
794
- it('should send msg to server', function() {
795
- // now you don’t care about the authentication, but
796
- // the controller will still send the request and
797
- // $httpBackend will respond without you having to
798
- // specify the expectation and response for this request
799
- $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, '');
832
+ it('should fetch authentication token', function() {
833
+ $httpBackend.expectGET('/auth.py');
834
+ var controller = createController();
835
+ $httpBackend.flush();
836
+ });
800
837
 
801
- var controller = scope.$new(MyController);
802
- $httpBackend.flush();
803
- controller.saveMessage('message content');
804
- expect(controller.status).toBe('Saving...');
805
- $httpBackend.flush();
806
- expect(controller.status).toBe('');
807
- });
808
838
 
839
+ it('should send msg to server', function() {
840
+ var controller = createController();
841
+ $httpBackend.flush();
809
842
 
810
- it('should send auth header', function() {
811
- $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) {
812
- // check if the header was send, if it wasn't the expectation won't
813
- // match the request and the test will fail
814
- return headers['Authorization'] == 'xxx';
815
- }).respond(201, '');
843
+ // now you don’t care about the authentication, but
844
+ // the controller will still send the request and
845
+ // $httpBackend will respond without you having to
846
+ // specify the expectation and response for this request
816
847
 
817
- var controller = scope.$new(MyController);
818
- controller.saveMessage('whatever');
819
- $httpBackend.flush();
820
- });
848
+ $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, '');
849
+ $rootScope.saveMessage('message content');
850
+ expect($rootScope.status).toBe('Saving...');
851
+ $httpBackend.flush();
852
+ expect($rootScope.status).toBe('');
853
+ });
854
+
855
+
856
+ it('should send auth header', function() {
857
+ var controller = createController();
858
+ $httpBackend.flush();
859
+
860
+ $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) {
861
+ // check if the header was send, if it wasn't the expectation won't
862
+ // match the request and the test will fail
863
+ return headers['Authorization'] == 'xxx';
864
+ }).respond(201, '');
865
+
866
+ $rootScope.saveMessage('whatever');
867
+ $httpBackend.flush();
868
+ });
869
+ });
821
870
  </pre>
822
871
  */
823
872
  angular.mock.$HttpBackendProvider = function() {
@@ -926,8 +975,8 @@ function createHttpBackendMock($delegate, $browser) {
926
975
  * @returns {requestHandler} Returns an object with `respond` method that control how a matched
927
976
  * request is handled.
928
977
  *
929
- * - respond `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
930
- * The respond method takes a set of static data to be returned or a function that can return
978
+ * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
979
+ * – The respond method takes a set of static data to be returned or a function that can return
931
980
  * an array containing response status (number), response data (string) and response headers
932
981
  * (Object).
933
982
  */
@@ -1039,14 +1088,16 @@ function createHttpBackendMock($delegate, $browser) {
1039
1088
  *
1040
1089
  * @param {string} method HTTP method.
1041
1090
  * @param {string|RegExp} url HTTP url.
1042
- * @param {(string|RegExp)=} data HTTP request body.
1091
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1092
+ * receives data string and returns true if the data is as expected, or Object if request body
1093
+ * is in JSON format.
1043
1094
  * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
1044
1095
  * object and returns true if the headers match the current expectation.
1045
1096
  * @returns {requestHandler} Returns an object with `respond` method that control how a matched
1046
1097
  * request is handled.
1047
1098
  *
1048
- * - respond `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1049
- * The respond method takes a set of static data to be returned or a function that can return
1099
+ * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1100
+ * – The respond method takes a set of static data to be returned or a function that can return
1050
1101
  * an array containing response status (number), response data (string) and response headers
1051
1102
  * (Object).
1052
1103
  */
@@ -1108,7 +1159,9 @@ function createHttpBackendMock($delegate, $browser) {
1108
1159
  * Creates a new request expectation for POST requests. For more info see `expect()`.
1109
1160
  *
1110
1161
  * @param {string|RegExp} url HTTP url.
1111
- * @param {(string|RegExp)=} data HTTP request body.
1162
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1163
+ * receives data string and returns true if the data is as expected, or Object if request body
1164
+ * is in JSON format.
1112
1165
  * @param {Object=} headers HTTP headers.
1113
1166
  * @returns {requestHandler} Returns an object with `respond` method that control how a matched
1114
1167
  * request is handled.
@@ -1122,7 +1175,9 @@ function createHttpBackendMock($delegate, $browser) {
1122
1175
  * Creates a new request expectation for PUT requests. For more info see `expect()`.
1123
1176
  *
1124
1177
  * @param {string|RegExp} url HTTP url.
1125
- * @param {(string|RegExp)=} data HTTP request body.
1178
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1179
+ * receives data string and returns true if the data is as expected, or Object if request body
1180
+ * is in JSON format.
1126
1181
  * @param {Object=} headers HTTP headers.
1127
1182
  * @returns {requestHandler} Returns an object with `respond` method that control how a matched
1128
1183
  * request is handled.
@@ -1136,7 +1191,9 @@ function createHttpBackendMock($delegate, $browser) {
1136
1191
  * Creates a new request expectation for PATCH requests. For more info see `expect()`.
1137
1192
  *
1138
1193
  * @param {string|RegExp} url HTTP url.
1139
- * @param {(string|RegExp)=} data HTTP request body.
1194
+ * @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
1195
+ * receives data string and returns true if the data is as expected, or Object if request body
1196
+ * is in JSON format.
1140
1197
  * @param {Object=} headers HTTP headers.
1141
1198
  * @returns {requestHandler} Returns an object with `respond` method that control how a matched
1142
1199
  * request is handled.
@@ -1196,7 +1253,7 @@ function createHttpBackendMock($delegate, $browser) {
1196
1253
  * "afterEach" clause.
1197
1254
  *
1198
1255
  * <pre>
1199
- * afterEach($httpBackend.verifyExpectations);
1256
+ * afterEach($httpBackend.verifyNoOutstandingExpectation);
1200
1257
  * </pre>
1201
1258
  */
1202
1259
  $httpBackend.verifyNoOutstandingExpectation = function() {
@@ -1389,8 +1446,8 @@ angular.module('ngMock', ['ng']).provider({
1389
1446
  $rootElement: angular.mock.$RootElementProvider
1390
1447
  }).config(function($provide) {
1391
1448
  $provide.decorator('$timeout', function($delegate, $browser) {
1392
- $delegate.flush = function() {
1393
- $browser.defer.flush();
1449
+ $delegate.flush = function(delay) {
1450
+ $browser.defer.flush(delay);
1394
1451
  };
1395
1452
  return $delegate;
1396
1453
  });
@@ -1448,7 +1505,7 @@ angular.module('ngMockE2E', ['ng']).config(function($provide) {
1448
1505
  *
1449
1506
  * // adds a new phone to the phones array
1450
1507
  * $httpBackend.whenPOST('/phones').respond(function(method, url, data) {
1451
- * phones.push(angular.fromJSON(data));
1508
+ * phones.push(angular.fromJson(data));
1452
1509
  * });
1453
1510
  * $httpBackend.whenGET(/^\/templates\//).passThrough();
1454
1511
  * //...
@@ -1473,11 +1530,11 @@ angular.module('ngMockE2E', ['ng']).config(function($provide) {
1473
1530
  * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that
1474
1531
  * control how a matched request is handled.
1475
1532
  *
1476
- * - respond `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1477
- * The respond method takes a set of static data to be returned or a function that can return
1533
+ * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}`
1534
+ * – The respond method takes a set of static data to be returned or a function that can return
1478
1535
  * an array containing response status (number), response data (string) and response headers
1479
1536
  * (Object).
1480
- * - passThrough `{function()}` Any request matching a backend definition with `passThrough`
1537
+ * - passThrough – `{function()}` – Any request matching a backend definition with `passThrough`
1481
1538
  * handler, will be pass through to the real backend (an XHR request will be made to the
1482
1539
  * server.
1483
1540
  */
@@ -1593,22 +1650,6 @@ angular.mock.clearDataCache = function() {
1593
1650
  };
1594
1651
 
1595
1652
 
1596
- window.jstestdriver && (function(window) {
1597
- /**
1598
- * Global method to output any number of objects into JSTD console. Useful for debugging.
1599
- */
1600
- window.dump = function() {
1601
- var args = [];
1602
- angular.forEach(arguments, function(arg) {
1603
- args.push(angular.mock.dump(arg));
1604
- });
1605
- jstestdriver.console.log.apply(jstestdriver.console, args);
1606
- if (window.console) {
1607
- window.console.log.apply(window.console, args);
1608
- }
1609
- };
1610
- })(window);
1611
-
1612
1653
 
1613
1654
  window.jasmine && (function(window) {
1614
1655
 
@@ -1653,7 +1694,7 @@ window.jasmine && (function(window) {
1653
1694
  * @name angular.mock.module
1654
1695
  * @description
1655
1696
  *
1656
- * *NOTE*: This is function is also published on window for easy access.<br>
1697
+ * *NOTE*: This function is also published on window for easy access.<br>
1657
1698
  * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}.
1658
1699
  *
1659
1700
  * This function registers a module configuration code. It collects the configuration information
@@ -1687,7 +1728,7 @@ window.jasmine && (function(window) {
1687
1728
  * @name angular.mock.inject
1688
1729
  * @description
1689
1730
  *
1690
- * *NOTE*: This is function is also published on window for easy access.<br>
1731
+ * *NOTE*: This function is also published on window for easy access.<br>
1691
1732
  * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}.
1692
1733
  *
1693
1734
  * The inject function wraps a function into an injectable function. The inject() creates new
@@ -1753,7 +1794,7 @@ window.jasmine && (function(window) {
1753
1794
  try {
1754
1795
  injector.invoke(blockFns[i] || angular.noop, this);
1755
1796
  } catch (e) {
1756
- if(e.stack) e.stack += '\n' + errorForStack.stack;
1797
+ if(e.stack && errorForStack) e.stack += '\n' + errorForStack.stack;
1757
1798
  throw e;
1758
1799
  } finally {
1759
1800
  errorForStack = null;
@@ -1761,4 +1802,4 @@ window.jasmine && (function(window) {
1761
1802
  }
1762
1803
  }
1763
1804
  };
1764
- })(window);
1805
+ })(window);