(function(buster, wire) {
"use strict";

var assert, refute, fail, functionModule, constructorModule;

assert = buster.assert;
refute = buster.refute;
fail = buster.assertions.fail;

functionModule = './test/node/fixtures/function';
constructorModule = './test/node/fixtures/constructor';

buster.testCase('create', {
	'should call non-constructor functions': function(done) {
		wire({
			test: {
				create: functionModule
			}
		}).then(
			function(context) {
				assert('test' in context);
			},
			fail
		).then(done, done);
	},

	'should call function with single arg': function(done) {
		wire({
			test: {
				create: {
					module: functionModule,
					args: 1
				}
			}
		}).then(
			function(context) {
				assert.equals(context.test, 1);
			},
			fail
		).then(done, done);
	},

	'should call function with multiple arg': function(done) {
		wire({
			test: {
				create: {
					module: functionModule,
					args: [1, 2]
				}
			}
		}).then(
			function(context) {
				assert.equals(context.test, 3);
			},
			fail
		).then(done, done);
	},

	'should call constructor functions using new': function(done) {
		wire({
			test: {
				create: constructorModule
			}
		}).then(
			function(context) {
				assert.isObject(context.test);
			},
			function(e) {
				console.error(e);
				return e;
			}
		).then(done, done);
	},

	'should call constructor functions with args': function(done) {
		wire({
			test: {
				create: {
					module: constructorModule,
					args: 1
				}
			}
		}).then(
			function(context) {
				assert.equals(context.test.value, 1);
			},
			fail
		).then(done, done);
	},

	'should wire args': function(done) {
		wire({
			test: {
				create: {
					module: functionModule,
					args: [
						{
							create: {
								module: functionModule,
								args: 1
							}
						},
						{
							create: {
								module: functionModule,
								args: 2
							}
						}
					]
				}
			}
		}).then(
			function(context) {
				assert.equals(context.test, 3);
			},
			fail
		).then(done, done);
	}

});

})(
	require('buster'),
	require('../../wire')
);
@@ -15,16 +15,30 @@
 er, wire
+, ExpectedType
 ) %7B%0A%22use
@@ -73,16 +73,30 @@
 e, fail,
+ objectModule,
  functio
@@ -204,16 +204,62 @@
 .fail;%0A%0A
+objectModule = './test/node/fixtures/object';%0A
 function
@@ -2094,18 +2094,715 @@
 one);%0A%09%7D
+,
 %0A%0A
+%09'should beget new object when used with object module': function(done) %7B%0A%09%09wire(%7B%0A%09%09%09child: %7B%0A%09%09%09%09create: objectModule%0A%09%09%09%7D%0A%09%09%7D).then(%0A%09%09%09function(context) %7B%0A%09%09%09%09assert.isObject(context.child);%0A%09%09%09%7D%0A%09%09).then(done, done);%0A%09%7D,%0A%0A%09'should beget new object when used with constructed object ref': function(done) %7B%0A%09%09wire(%7B%0A%09%09%09parent: %7B%0A%09%09%09%09create: %7B%0A%09%09%09%09%09module: constructorModule,%0A%09%09%09%09%09args: 1%0A%09%09%09%09%7D%0A%09%09%09%7D,%0A%09%09%09child: %7B%0A%09%09%09%09create: %7B $ref: 'parent' %7D%0A%09%09%09%7D%0A%09%09%7D).then(%0A%09%09%09function(context) %7B%0A%09%09%09%09assert.isObject(context.child);%0A%09%09%09%09assert(context.child instanceof ExpectedType);%0A%09%09%09%09assert.equals(context.child.value, 1);%0A%09%09%09%09refute(context.child.hasOwnProperty('value'));%0A%09%09%09%7D%0A%09%09).then(done, done);%0A%09%7D%0A
 %7D);%0A%0A%7D)(
@@ -2844,11 +2844,47 @@
 ./wire')
+,%0A%09require('./fixtures/constructor')
 %0A);

Fix #36 Integrate prototype functionality into create factory, and deprecate prototype factory. Keep prototype factory unit tests for now, until we actually remove the factory.