describe('PlayersController', function() {
  var scope = null;
  var ctrl = null;
  var location = null;
  var stateParams = null;
  var resource = null;
  var httpBackend = null;
  var playerId = 42;
  var state;

  var fakePlayer = {
      "id": playerId,
      "name":"Tia",
      "surname":"Pollich",
      "birthday":"1994-07-26",
      "rank":"dan_4",
      "sex":"female",
      "club_id":77
  }

  var setupController = function(playerExists, playerId, results, stateName) {
    return inject(function($location, $stateParams, $rootScope, $resource, $httpBackend, $controller, $state, $templateCache) {
      scope = $rootScope.$new();
      location = $location;
      resource = $resource;
      stateParams = $stateParams;
      httpBackend = $httpBackend;

      state = $state;

      $templateCache.put('Players/_index.html','');
      $templateCache.put('Players/_show.html','');
      //$templateCache.put('Clubs/_form.html','');

      state.go(stateName);
      $rootScope.$apply();
      var request = null;

      if(results) {
        request = new RegExp("players");
        httpBackend.expectGET(request).respond(results);
      } else if (playerId) {
        stateParams.playerId = playerId;
        request = new RegExp("players/" + playerId);
        results = (playerExists)?[200, fakePlayer]:[404];
        httpBackend.expectGET(request).respond(results[0], results[1]);
      }

      ctrl = $controller('PlayersController', {
        $scope: scope,
        $location: location,
        $state: state
      });
    });
  };

  beforeEach(module('ippon'));

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

  describe('index', function(){
    var players = [
      {
        "id":71,
        "name":"Tessie",
        "surname":"Ryan",
        "birthday":"1979-04-28",
        "rank":"kyu_3",
        "sex":"male",
        "club_id":71
      },
      {
        "id":72,
        "name":"Elza",
        "surname":"Spinka",
        "birthday":"1982-01-22",
        "rank":"dan_1",
        "sex":"male",
        "club_id":72
      },{
        "id":73,
        "name":"Ines",
        "surname":"Hirthe",
        "birthday":"1970-04-18",
        "rank":"kyu_3",
        "sex":"male",
        "club_id":73
      },
      {
        "id":74,
        "name":"Isac",
        "surname":"Fritsch",
        "birthday":"1957-09-06",
        "rank":"dan_1",
        "sex":"female",
        "club_id":74
      },
      {
        "id":75,
        "name":"Trenton",
        "surname":"Denesik",
        "birthday":"1990-05-04",
        "rank":"dan_2",
        "sex":"female",
        "club_id":75
      },
      {
        "id":76,
        "name":"Karlee",
        "surname":"Kuhic",
        "birthday":"1965-12-10",
        "rank":"kyu_5",
        "sex":"female",
        "club_id":76
      }];

    beforeEach(function(){
      setupController(false,false,players,'players');
      httpBackend.flush();
    });
    it('calls the back-end', function() {
      expect(scope.players).toEqualData(players);
    });
  });

  describe('show',function(){
    describe('player is found', function() {
      beforeEach(function() {
        setupController(true,42,false,'players_show');
      });
      it('loads the given player', function() {
        httpBackend.flush();
        expect(scope.player).toEqualData(fakePlayer);
      });
    });

    describe('player is not found', function() {
      beforeEach(setupController(false, playerId,false,'players_show'));
      it("doesn't load a player", function() {
        httpBackend.flush();
        expect(scope.player).toBe(null);
        //flash about error
      });
    });
  });
});

@@ -3708,13 +3708,954 @@
 );%0A  %7D);
+%0A%0A  describe('create', function() %7B%0A    var newPlayer = %7B%0A      id: 104,%0A      name: %22Steve%22,%0A      surname: %22Balistreri%22,%0A      birthday: %221960-10-06%22,%0A      rank: %22dan_7%22,%0A      sex: %22male%22,%0A      club_id: 120%0A    %7D;%0A%0A    beforeEach(function() %7B%0A      setupController(false, false, false, 'players_new');%0A      var request = new RegExp(%22%5C/players%22);%0A      httpBackend.expectPOST(request).respond(201, newPlayer);%0A    %7D);%0A%0A    it('post to the backend', function() %7B%0A      scope.player.name = newPlayer.name;%0A      scope.player.surname = newPlayer.surname;%0A      scope.player.birthday = newPlayer.birthday;%0A      scope.player.rank = newPlayer.rank;%0A      scope.player.sex = newPlayer.sex;%0A      scope.player.club_id = newPlayer.club_id;%0A%0A      scope.save();%0A      scope.$apply();%0A      httpBackend.flush();%0A      expect('#' + location.path()).toBe(state.href('players_show'));%0A      expect(state.is('players_show')).toBe(true);%0A    %7D);%0A  %7D);
 %0A%7D);%0A

Add PlayersController.create spec