Last active
August 29, 2015 14:27
-
-
Save sagivf/2eef31571454c5f6441c to your computer and use it in GitHub Desktop.
Angular DRY mocking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
leoConfiguration.addStates([ | |
{ | |
name: 'flicker-images', | |
verb: "jsonp", | |
url: 'http://api.flickr.com/services/feeds/photos_public.gne', | |
options: [ | |
{ | |
name: 'get ninja turtles', status: 200, | |
data: { | |
"items": [ | |
{ "id": "20054214406", "farm": 1, "title": "leo1"}, | |
{ "id": "19896041068", "farm": 1, "title": "017580"} | |
] | |
} | |
},{ | |
name: 'get ninja enemies', status: 200, | |
data: { | |
"items": [ | |
{ "id": "20058148116", "title": "the_shredder"}, | |
{ "id": "20102720711", "title": "the_ninjas" } | |
] | |
} | |
} | |
] | |
} | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
leoConfiguration.addState({ | |
name: 'Set Mission', | |
options: [ | |
{ name: 'turtles', data: "Protect April o'neil" }, | |
{ name: 'shredder', data: 'Destroy the ninja turtles' } | |
] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
leoConfiguration.addState({ | |
name: 'Set Mission', | |
options: [ | |
{ name: 'turtles', data: "Protect April o'neil" }, | |
{ name: 'shredder', data: 'Destroy the ninja turtles' } | |
] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rootScope.$on('leonardo:setStates', function(){ | |
var debug = leoConfiguration.getState('debug'); | |
$rootScope.debug = !!debug; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mission = leoConfiguration.getState('Set Mission'); | |
$rootScope.mission = mission ? mission.data : ""; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment