From 8e33b6b5347f5f5523ae1206713b5ed713e791a4 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Mon, 9 Jun 2014 12:26:47 +0200 Subject: [PATCH] Fixed all server-sided tests NEVER. AGAIN --- server/achievements/Achievement.coffee | 7 ++++--- server/levels/components/level_component_handler.coffee | 4 ++-- server/levels/systems/level_system_handler.coffee | 2 +- server/plugins/achievements.coffee | 3 ++- server/plugins/plugins.coffee | 1 - test/server/functional/file.spec.coffee | 6 ++++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/server/achievements/Achievement.coffee b/server/achievements/Achievement.coffee index faa625654..2f99443b5 100644 --- a/server/achievements/Achievement.coffee +++ b/server/achievements/Achievement.coffee @@ -1,5 +1,4 @@ mongoose = require('mongoose') -plugins = require('../plugins/plugins') jsonschema = require('../../app/schemas/models/achievement') log = require 'winston' @@ -29,7 +28,9 @@ AchievementSchema.pre('save', (next) -> next() ) +module.exports = Achievement = mongoose.model('Achievement', AchievementSchema) + +plugins = require('../plugins/plugins') + AchievementSchema.plugin(plugins.NamedPlugin) AchievementSchema.plugin(plugins.SearchablePlugin, {searchable: ['name']}) - -module.exports = Achievement = mongoose.model('Achievement', AchievementSchema) diff --git a/server/levels/components/level_component_handler.coffee b/server/levels/components/level_component_handler.coffee index 3bcc572d0..98844ddbc 100644 --- a/server/levels/components/level_component_handler.coffee +++ b/server/levels/components/level_component_handler.coffee @@ -9,7 +9,7 @@ LevelComponentHandler = class LevelComponentHandler extends Handler 'description' 'code' 'js' - 'language' + 'codeLanguage' 'dependencies' 'propertyDocumentation' 'configSchema' @@ -25,4 +25,4 @@ LevelComponentHandler = class LevelComponentHandler extends Handler req.method is 'GET' or req.user?.isAdmin() -module.exports = new LevelComponentHandler() \ No newline at end of file +module.exports = new LevelComponentHandler() diff --git a/server/levels/systems/level_system_handler.coffee b/server/levels/systems/level_system_handler.coffee index bf1bb39d5..e19dd43bd 100644 --- a/server/levels/systems/level_system_handler.coffee +++ b/server/levels/systems/level_system_handler.coffee @@ -7,7 +7,7 @@ LevelSystemHandler = class LevelSystemHandler extends Handler 'description' 'code' 'js' - 'language' + 'codeLanguage' 'dependencies' 'propertyDocumentation' 'configSchema' diff --git a/server/plugins/achievements.coffee b/server/plugins/achievements.coffee index 9fd6a9c94..2292e81e4 100644 --- a/server/plugins/achievements.coffee +++ b/server/plugins/achievements.coffee @@ -1,7 +1,6 @@ mongoose = require('mongoose') Achievement = require('../achievements/Achievement') EarnedAchievement = require '../achievements/EarnedAchievement' -User = require '../users/User' LocalMongo = require '../../app/lib/LocalMongo' util = require '../../app/lib/utils' log = require 'winston' @@ -19,6 +18,8 @@ loadAchievements = -> loadAchievements() module.exports = AchievablePlugin = (schema, options) -> + User = require '../users/User' + checkForAchievement = (doc) -> collectionName = doc.constructor.modelName diff --git a/server/plugins/plugins.coffee b/server/plugins/plugins.coffee index b2b0b1737..77290ad90 100644 --- a/server/plugins/plugins.coffee +++ b/server/plugins/plugins.coffee @@ -1,5 +1,4 @@ mongoose = require('mongoose') -User = require('../users/User') textSearch = require('mongoose-text-search') module.exports.MigrationPlugin = (schema, migrations) -> diff --git a/test/server/functional/file.spec.coffee b/test/server/functional/file.spec.coffee index 0fb58ffd8..546405f32 100644 --- a/test/server/functional/file.spec.coffee +++ b/test/server/functional/file.spec.coffee @@ -6,7 +6,8 @@ describe '/file', -> options = { uri:url json: { - url: 'http://scotterickson.info/images/where-are-you.jpg' + # url: 'http://scotterickson.info/images/where-are-you.jpg' + url: 'http://fc07.deviantart.net/fs37/f/2008/283/5/1/Chu_Chu_Pikachu_by_angelishi.gif' filename: 'where-are-you.jpg' mimetype: 'image/jpeg' description: 'None!' @@ -20,7 +21,8 @@ describe '/file', -> filename: 'ittybitty.data' mimetype: 'application/octet-stream' description: 'rando-info' - my_buffer_url: 'http://scotterickson.info/images/where-are-you.jpg' + # my_buffer_url: 'http://scotterickson.info/images/where-are-you.jpg' + my_buffer_url: 'http://fc07.deviantart.net/fs37/f/2008/283/5/1/Chu_Chu_Pikachu_by_angelishi.gif' } it 'preparing test : deletes all the files first', (done) ->