codecombat/test/demo/views/achievement/UserAchievements.demo.coffee
2014-07-07 15:03:28 +02:00

29 lines
925 B
CoffeeScript

Achievement = require 'models/Achievement'
Achievements = require 'collections/AchievementCollection'
UserAchievementsView = require 'views/user/achievements'
EarnedAchievement = require 'models/EarnedAchievement'
EarnedAchievementCollection = require 'collections/EarnedAchievementCollection'
fixtures = require '../../fixtures/achievements'
module.exports = ->
view = new UserAchievementsView {}, me.get '_id'
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
view.render()