1+ /* global describe, beforeEach, inject, afterEach, it, expect, spyOn */
2+ /* jshint unused: false */
13describe ( 'Restangular' , function ( ) {
24 // API
3- var Restangular , $httpBackend ;
4- var accountsModel , restangularAccounts , restangularAccount0 , restangularAccount1 ;
5- var accountsHalModel ;
6- var messages , newAccount , nextAccountId ;
5+ var Restangular , $httpBackend ,
6+ accountsModel , restangularAccounts , restangularAccount0 , restangularAccount1 ,
7+ infoModel , accountsDoSomethingModel , customers , publications , newCustomer ,
8+ accountsHalModel ,
9+ messages , newAccount , nextAccountId ;
710
811 // Load required modules
912 beforeEach ( angular . mock . module ( 'restangular' ) ) ;
@@ -873,7 +876,7 @@ describe('Restangular', function() {
873876 } ) . then ( function ( accountFromServer2 ) {
874877 expect ( accountFromServer2 . route ) . toBe ( account1 . route ) ;
875878 } ) ;
876- $httpBackend . flush ( )
879+ $httpBackend . flush ( ) ;
877880 } ) ;
878881
879882 it ( 'Should make RequestLess connections with one' , function ( ) {
@@ -1018,7 +1021,7 @@ describe('Restangular', function() {
10181021 } ) ;
10191022
10201023 it ( 'should allow for a custom method to be placed at the model level when several models are requested' , function ( ) {
1021- var accountPromise ;
1024+ var accountsPromise ;
10221025
10231026 Restangular . addElementTransformer ( 'accounts' , false , function ( model ) {
10241027 model . prettifyAmount = function ( ) { } ;
@@ -1028,16 +1031,16 @@ describe('Restangular', function() {
10281031 accountsPromise = Restangular . all ( 'accounts' , 1 ) . getList ( ) ;
10291032
10301033 accountsPromise . then ( function ( accounts ) {
1031- accounts . forEach ( function ( account , index ) {
1034+ accounts . forEach ( function ( account ) {
10321035 expect ( typeof account . prettifyAmount ) . toEqual ( 'function' ) ;
10331036 } ) ;
10341037 } ) ;
10351038
10361039 $httpBackend . flush ( ) ;
10371040 } ) ;
10381041
1039- it ( " should allow for a custom method to be placed at the collection level using a regexp matching the route" , function ( ) {
1040- var accountPromise ;
1042+ it ( ' should allow for a custom method to be placed at the collection level using a regexp matching the route' , function ( ) {
1043+ var accountsPromise ;
10411044
10421045 Restangular . addElementTransformer ( / ^ a c c o u n t s / , false , function ( model ) {
10431046 model . prettifyAmount = function ( ) { } ;
@@ -1047,15 +1050,15 @@ describe('Restangular', function() {
10471050 accountsPromise = Restangular . all ( 'accounts/search/byOwner' , 1 ) . getList ( ) ;
10481051
10491052 accountsPromise . then ( function ( accounts ) {
1050- accounts . forEach ( function ( account , index ) {
1051- expect ( typeof account . prettifyAmount ) . toEqual ( " function" ) ;
1053+ accounts . forEach ( function ( account ) {
1054+ expect ( typeof account . prettifyAmount ) . toEqual ( ' function' ) ;
10521055 } ) ;
10531056 } ) ;
10541057
10551058 $httpBackend . flush ( ) ;
10561059 } ) ;
10571060
1058- it ( " should allow for a custom method to be placed at the model level using regexp route when one model is requested" , function ( ) {
1061+ it ( ' should allow for a custom method to be placed at the model level using regexp route when one model is requested' , function ( ) {
10591062 var accountPromise ;
10601063
10611064 Restangular . addElementTransformer ( / ^ a c c o u n t s / , false , function ( model ) {
@@ -1066,14 +1069,14 @@ describe('Restangular', function() {
10661069 accountPromise = Restangular . one ( 'accounts' , 1 ) . get ( ) ;
10671070
10681071 accountPromise . then ( function ( account ) {
1069- expect ( typeof account . prettifyAmount ) . toEqual ( " function" ) ;
1072+ expect ( typeof account . prettifyAmount ) . toEqual ( ' function' ) ;
10701073 } ) ;
10711074
10721075 $httpBackend . flush ( ) ;
10731076 } ) ;
10741077
1075- it ( " should allow for a custom method to be placed at the model level using regexp when several models are requested" , function ( ) {
1076- var accountPromise ;
1078+ it ( ' should allow for a custom method to be placed at the model level using regexp when several models are requested' , function ( ) {
1079+ var accountsPromise ;
10771080
10781081 Restangular . addElementTransformer ( / ^ a c c o u n t s / , false , function ( model ) {
10791082 model . prettifyAmount = function ( ) { } ;
@@ -1083,8 +1086,8 @@ describe('Restangular', function() {
10831086 accountsPromise = Restangular . all ( 'accounts' , 1 ) . getList ( ) ;
10841087
10851088 accountsPromise . then ( function ( accounts ) {
1086- accounts . forEach ( function ( account , index ) {
1087- expect ( typeof account . prettifyAmount ) . toEqual ( " function" ) ;
1089+ accounts . forEach ( function ( account ) {
1090+ expect ( typeof account . prettifyAmount ) . toEqual ( ' function' ) ;
10881091 } ) ;
10891092 } ) ;
10901093
@@ -1244,7 +1247,7 @@ describe('Restangular', function() {
12441247 } ) ;
12451248
12461249 it ( 'getRestangularUrl() returns still the url without id after GET' , function ( ) {
1247- record = Restangular . one ( 'info' , 0 , true ) ;
1250+ var record = Restangular . one ( 'info' , 0 , true ) ;
12481251 record . get ( ) . then ( function ( data ) {
12491252 expect ( data . getRestangularUrl ( ) ) . toEqual ( '/info' ) ;
12501253 } ) ;
0 commit comments