Skip to content

Instantly share code, notes, and snippets.

@stephennancekivell
Created September 19, 2012 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephennancekivell/3749076 to your computer and use it in GitHub Desktop.
Save stephennancekivell/3749076 to your computer and use it in GitHub Desktop.
<!-- for using mocked data while testing -->
<script type="text/javascript" src="../test/lib/angular/angular-mocks.js"></script>
<script type="text/javascript" src="../test/e2e/mocks.js"></script>
App.config(function($provide){
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
});
App.run(function($httpBackend){
console.log('Setting up mocks');
$httpBackend.whenGET('/rest/foo?query=bar').
respond({"foo":"bar"});
});
describe('app', function() {
beforeEach(function() { browser().navigateTo('../../app/app.test.html');});
it('should render the response', function() {
expect(element('.bar').text().tobe('bar');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment