describe("Github API service", function() {
    var githubApiUrl = "https://api.github.com",
        httpBackend, githubService,
        tokenService = {get: function() {}};

    beforeEach(function() {
        module("nimble", function($provide) {
            $provide.value("token", tokenService);
        });
        inject(function($httpBackend, github) {
            httpBackend = $httpBackend;
            githubService = github;
        });

        spyOn(tokenService, "get").and.returnValue("test");
    });

    afterEach(function() {
        httpBackend.verifyNoOutstandingExpectation();
        httpBackend.verifyNoOutstandingRequest();
    });

    it("grabs the metadata for the user", function() {
        httpBackend.expectGET(githubApiUrl + "/user?access_token=test&per_page=100")
            .respond({id: 1});

        githubService.getUser().then(function(data) {
            expect(data).toEqual({id: 1});
        });

        httpBackend.flush();
    });

    it("handles a failure to get user metadata", function() {
        httpBackend.expectGET(githubApiUrl + "/user?access_token=test&per_page=100")
            .respond(404);

        githubService.getUser().then(function(data) {},
            function(reason) {
                expect(reason).toEqual({status: 404});
            });

        httpBackend.flush();
    });
});
@@ -840,32 +840,45 @@
 ithubService.get
+Authenticated
 User().then(func
@@ -886,24 +886,24 @@
 ion(data) %7B%0A
-
             
@@ -1184,16 +1184,29 @@
 vice.get
+Authenticated
 User().t
@@ -1310,24 +1310,24 @@
 tus: 404%7D);%0A
-
             
@@ -1323,32 +1323,525 @@
            %7D);%0A%0A
+        httpBackend.flush();%0A    %7D);%0A%0A    it(%22gets all pages of repo results%22, function() %7B%0A        httpBackend.expectGET(githubApiUrl + %22/user/repos?access_token=test&per_page=100%22)%0A            .respond(%5B1,2,3%5D, %7B%0A                Link: %22%3Chttp://page1.com%3E; rel=%5C%22next%5C%22%22%0A            %7D);%0A%0A        httpBackend.expectGET(%22http://page1.com%22)%0A            .respond(%5B4,5,6%5D);%0A%0A        githubService.listYourRepos().then(function(data) %7B%0A            expect(data).toEqual(%5B1,2,3,4,5,6%5D);%0A        %7D);%0A%0A
         httpBack

fix broken tests, add paging test for repos #7