Most of the questions in this group asking simular questions go answered. I
hope someone can help with this. Thanks.
On Monday, April 28, 2014 1:51:40 PM UTC-7, george Norris wrote:
>
> 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.