846e416f767b39370393f09dbed34f2a7ce449cb
[JavaScriptForFun] / angularjs / showcase / src / showcase / app / cars / cars.service.spec.js
1 describe('app.cars', function() {
2   'use strict';
3
4   var $httpBackend;
5   var $log;
6   var cars;
7   var API;
8
9   beforeEach(function() {
10     module('app.cars');
11
12     inject(function(_$httpBackend_, _$log_, _cars_, _API_) {
13       $httpBackend = _$httpBackend_;
14       $log = _$log_;
15       cars = _cars_;
16       API = _API_;
17     });
18   });
19
20   describe('cars service', function () {
21
22     it('should invoke GET all cars', function () {
23       $httpBackend.expectGET(API.CARS).respond({});
24
25       cars.getAll();
26
27       $httpBackend.flush();
28     });
29   });
30
31   afterEach(function() {
32     $httpBackend.verifyNoOutstandingExpectation();
33     $httpBackend.verifyNoOutstandingRequest();
34   });
35
36 });