Hello. I am new to Angular but somewhat experienced with Rails. 

I'm having the tough time getting Jasmine unit tests set up with Angular / 
Rails. 

Previously, I've worked with Backbone and Jasmine so I have some experience 
with Jasmine and setting it up. 

Please tell what I am doing wrong.


//Using Rails, Jasmine, Teaspoon test runner.


// ------------------ controller ------------------
// Defined Module and namespace for controllers..
angular.module('myApp.controllers');

//set up controller
controllers.controller('fooCtrl', function(){
  $scope.msg = ''hello";
  $scope.sayMsg = function(){
    alert($scope.msg);
  };
});

// ------------------ tests helper ------------------
// Teaspoon has spec_helper.js. 
// Here i've included these..
//= require angular-mocks
//= require application



// ------------------ indivdual tests ------------------

describe("myCtrl", function(){
  var appCtrl;
  beforeEach( module("upstart") );

  beforeEach(
    inject(
      function($controller, $rootScope) {
        scope = $rootScope.$new();
        appCtrl = $controller("controllers.myCtrl", { $scope: scope });
      }
    )
  );

  it("has a appCtrl", function(){
    expect(appCtrl).toBeDefined();
  });

});

This results in:
*Error: [ng:areq] Argument 'controllers.* *fooCtrl**' is not a function, 
got undefined*


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to