CruGlobal/mpdx — pull request #94 by draffensperger (2014-07-31 00:16:35+00:00)
Title: Make karma test fail Travis, and fixed failing test case 

Hey all! I'm new to MPDX and I'm just starting to get familiar with the source code. Here's something I noticed and tried to fix (but I admit I could definitely be off on this and if nothing else it'll be a learning exercise for me):

The output from the most recent Travis build (https://travis-ci.org/CruGlobal/mpdx/builds/31272611) it seems like the karma test task "bundle exec rake karma:run" is reporting failures that aren't being noticed by Travis and causing it to accept the build as having no errors.

Error in from the karma tests:
````
TypeError: 'null' is not an object (evaluating 'document.getElementById('contacts-scrollable').scrollTop = 0')
at /home/travis/build/CruGlobal/mpdx/app/assets/javascripts/angular/controllers/contacts.js:265
at /home/travis/build/CruGlobal/mpdx/app/assets/javascripts/angular/services/api.js:23
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:7946
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:11319
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:11319
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:11405
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:12412
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:12224
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:12516
at done (/home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular.js:8204)
at handleResponse (/home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular-mocks.js:1131)
at /home/travis/build/CruGlobal/mpdx/vendor/bundle/ruby/2.0.0/gems/angularjs-rails-1.2.16/vendor/assets/javascripts/angular-mocks.js:1448
at /home/travis/build/CruGlobal/mpdx/spec/javascripts/angular/controllers/contacts_spec.js:75
```

I wonder if this has something to do with the DOM not being fully initiated when the tests ran. One quick fix is to check to see if the element "contacts-scrollable" is null in contacts.js which I included here. I'd have to learn more to know the deeper reason for the error and what a better long-term solution is.

But to make it so that future karma test errors would cause the build to fail, I added a "fail unless ..." to the karma rake task.