Commit 9a1cf963 authored by antirek's avatar antirek

fix setVariable

parent 9d48a279
var AGIServer = require('./lib/index');
var handler = function (context) {
context.onEvent('variables')
.then(function (vars) {
return context.streamFile('beep');
})
.then(function (result) {
return context.end();
});
context.onEvent('variables')
.then(function (vars) {
return context.streamFile('beep');
})
.then(function (result) {
return context.setVariable('RECOGNITION_RESULT', 'I\'m your father, Luc');
})
.then(function (result) {
return context.end();
});
};
var agi = new AGIServer(handler);
......
......@@ -225,7 +225,7 @@ Context.prototype.setMusic = function (musicclass) {
};
Context.prototype.setVariable = function (name, value) {
return this.sendCommand('SET VARIABLE ' + name + ' ' + value);
return this.sendCommand('SET VARIABLE ' + name + ' "' + value + '"');
};
Context.prototype.sendImage = function (image) {
......
......@@ -235,8 +235,8 @@ describe('Context', function() {
describe('setVariable', function() {
it('sends correct command', function() {
this.context.setVariable('test', 'test');
expect(this.context.sent.join('')).to.eql('SET VARIABLE test test\n');
this.context.setVariable('test', 'test test test');
expect(this.context.sent.join('')).to.eql('SET VARIABLE test "test test test"\n');
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment