apigeek-dialect
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -34,3 +34,3 @@ var Yadda = require('yadda'); // https://github.com/acuminous/yadda | ||
scope = _.extend(scope, config.vars); | ||
// scope = _.extend(scope, config.vars); | ||
@@ -37,0 +37,0 @@ var Locale = Yadda.localisation[this.config.yadda.l16n]; |
@@ -9,3 +9,3 @@ var Events = require('events'); | ||
module.exports = function(dialect, feature, config) { | ||
module.exports = function(dialect, feature, scope) { | ||
assert(dialect, "Missing dialect"); | ||
@@ -15,6 +15,4 @@ assert(dialect.execute, "Dialect can't execute"); | ||
assert(feature.title, "Missing feature title"); | ||
var scope = config || {}; | ||
assert(scope, "Missing scope"); | ||
//debug("Init: %j", scope); | ||
var self = this; | ||
@@ -65,3 +63,2 @@ _.extend(this, new Events.EventEmitter()); | ||
var scope = _.extend({ vars: {} }, config, { name: "feature" }); | ||
//debug("Feature 2: %j", scope); | ||
@@ -74,8 +71,9 @@ | ||
_.each(feature.scenarios, function (scenario) { | ||
var scenario_scope = _.extend({}, scope, { name: "scenario"}); | ||
scenario_scope.vars = _.extend({}, scenario_scope.vars); | ||
var _scope = _.extend({}, scope, { name: "feature" }); | ||
// var scenario_scope = _.extend({}, scope, { name: "scenario"}); | ||
// scenario_scope.vars = scope.vars; | ||
if (!dialect.noop(scenario.annotations)) { | ||
var story = self.story(scenario, scenario_scope); | ||
var story = self.story(scenario, _scope); | ||
suite.addTest(story); | ||
@@ -82,0 +80,0 @@ self.emit("story", story, scenario); |
@@ -20,2 +20,8 @@ var assert = require('assert'); | ||
http.getClientAddress = function (req) { | ||
assert(req, "Missing request"); | ||
assert(req.connection, "Missing connection"); | ||
return (req.headers['x-forwarded-for'] || '').split(',')[0] || req.connection.remoteAddress; | ||
} | ||
http.authorize = function (request, principal) { | ||
@@ -22,0 +28,0 @@ var base64 = new Buffer(principal.username + ':' + principal.password).toString('base64'); |
@@ -6,2 +6,7 @@ var assert = require("assert"); | ||
sanitize: function (txt) { | ||
if (!txt) return ""; | ||
return txt.replace(/\W/g, ''); | ||
}, | ||
find: function(scope, name) { | ||
@@ -13,3 +18,3 @@ assert(scope, "missing scope"); | ||
} | ||
return scope.vars[name]; | ||
return self.get(scope.vars,name); | ||
}, | ||
@@ -16,0 +21,0 @@ synonym: function(model, synoyms) { |
@@ -32,2 +32,3 @@ #!/usr/bin/env node | ||
apigeek.execute(); | ||
} | ||
@@ -42,2 +43,2 @@ return apigeek; | ||
return self.auto(); | ||
self.auto(); |
@@ -16,2 +16,7 @@ var assert = require('assert'); | ||
learn.given(["I clear variables", "I reset variables"], function(done) { | ||
for (var name in this.vars) delete this.vars[name]; | ||
done && done(); | ||
}); | ||
learn.given(["I set $varname to $value", "I set $varname = $value", "I define $varname = $value", "I define $varname is $value"], function(name, value, done) { | ||
@@ -18,0 +23,0 @@ vars.set(this.vars, name, value); |
{ | ||
"name": "apigeek-dialect", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "A Gherkin-based micro-framework", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
115939
1836