Skip to content

Instantly share code, notes, and snippets.

@jdart
Created October 24, 2014 22:36
Show Gist options
  • Save jdart/8ea75117702c7ceb1166 to your computer and use it in GitHub Desktop.
Save jdart/8ea75117702c7ceb1166 to your computer and use it in GitHub Desktop.
angular.module('thing', ['ionic'])
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('login', {
url: "/login",
templateUrl: "views/login.html",
controller: "LoginCtrl"
});
})
.factory('someFactory', function($http) {
return {
test: function() {
$http.get('http://google.com')
}
}
});
describe('thing', function() {
var $httpBackend;
var someFactory;
beforeEach(module('thing'));
beforeEach(function() {
module(function ($provide) {
$provide.value('state', {
state: function() { return this; }
});
});
});
beforeEach(inject(function(_$httpBackend_, _someFactory_) {
$httpBackend = _$httpBackend_;
someFactory = _someFactory_;
}));
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
});
it('anything', function(){
someFactory.test();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment