Skip to content

Commit

Permalink
Merge pull request #13 from dockyard/bc-escape-single-quotes
Browse files Browse the repository at this point in the history
Escape single quotes
  • Loading branch information
bcardarella committed Sep 27, 2014
2 parents 6083f81 + 2f9ebb7 commit e37efed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ QUnit.proxyFixtures = function(name) {
if (proxyFixtures && proxyFixtures[details.module] && proxyFixtures[details.module][details.name]) {
var fixtures = proxyFixtures[details.module][details.name];

function escape(str) {
return str.replace(/'/g, "\\'");
}

server = new Pretender(function() {
for (var path in fixtures) {
for (var method in fixtures[path]) {
var code = "" +
"var proxyFixtures = window['"+name+"'];\n" +
"var query = Ember.$.param(request.queryParams);\n" +
"var fixtures = proxyFixtures['"+details.module+"']['"+details.name+"'];\n" +
"var fixtures = proxyFixtures['"+escape(details.module)+"']['"+escape(details.name)+"'];\n" +
"var fixture = fixtures['"+path+"']['"+method+"'][query].fixtures[fixtures['"+path+"']['"+method+"'][query].offset];\n" +
"fixtures['"+path+"']['"+method+"'][query].offset += 1;\n" +
"return [fixture.statusCode, fixture.headers, fixture.body];\n";
Expand Down

0 comments on commit e37efed

Please sign in to comment.