Skip to content
2 changes: 1 addition & 1 deletion backbone.geppetto.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
if (this._mappings.hasOwnProperty(key)) {
var config = this._mappings[key];
if (!overrideRules && config.type === TYPES.SINGLETON) {
if (!config.object) {
if (!config.object && config.clazz) {
config.object = this._createAndSetupInstance(config);
}
output = config.object;
Expand Down
1 change: 1 addition & 0 deletions specs/src/geppetto-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ define([

});


describe("when triggering commands", function() {
var context;
var CommandClass;
Expand Down
41 changes: 41 additions & 0 deletions specs/src/resolver-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@ define([
describe("when mapping a value", function() {
var key = 'a value';
var value = {};
var spy;


beforeEach(function() {
context.wireValue(key, value);
});

it('should be determinable', function() {
expect(context.hasWiring(key)).to.be.true;
});
Expand All @@ -165,6 +169,43 @@ define([
var second = context.getObject(key);
expect(second).to.equal(first);
});

it("it should accept the value 'false' as mapped value", function(){
spy = sinon.spy(function() {
context.wireValue('false', false);
context.getObject('false');
});
spy();
expect(spy).to.have.not.thrown();
});

it("it should accept empty string as mapped value", function(){
spy = sinon.spy(function() {
context.wireValue('empty_string', '');
context.getObject('empty_string');
});
spy();
expect(spy).to.have.not.thrown();
});

it("it should accept 0 as mapped value", function(){
spy = sinon.spy(function() {
context.wireValue('zero', 0);
context.getObject('zero');
});
spy();
expect(spy).to.have.not.thrown();
});

it("it should accept null as mapped value", function(){
spy = sinon.spy(function() {
context.wireValue('null_value', null);
context.getObject('null_value');
});
spy();
expect(spy).to.have.not.thrown();
});

});
describe("when mapping a class", function() {
var key = 'a class';
Expand Down