codecombat/test/demo/views/achievement/UserAchievements.demo.coffee

30 lines
925 B
CoffeeScript
Raw Normal View History

2014-07-06 17:16:00 -04:00
Achievement = require 'models/Achievement'
Achievements = require 'collections/AchievementCollection'
2014-07-06 17:38:57 -04:00
UserAchievementsView = require 'views/user/achievements'
2014-07-06 17:16:00 -04:00
EarnedAchievement = require 'models/EarnedAchievement'
EarnedAchievementCollection = require 'collections/EarnedAchievementCollection'
2014-07-06 17:38:57 -04:00
fixtures = require '../../fixtures/achievements'
2014-07-06 17:16:00 -04:00
2014-07-06 17:38:57 -04:00
module.exports = ->
view = new UserAchievementsView {}, me.get '_id'
2014-07-07 06:44:44 -04:00
2014-07-07 09:03:28 -04:00
respond = (request) ->
return unless request
if request.url.match /db\/achievement/
request.response
status: 200
responseText: JSON.stringify fixtures.achievements
else if request.url.match /db\/user\/[a-z0-9]*\/achievements/
request.response
status: 200
responseText: JSON.stringify fixtures.earnedAchievements
else
request.response
status: 404
_.each jasmine.Ajax.requests.all(), (request) -> respond request
2014-07-07 06:44:44 -04:00
2014-07-06 17:38:57 -04:00
view.render()