WIP on init/start connections and devices

This commit is contained in:
deadprogram 2013-10-19 22:25:31 -07:00
parent 17be53408a
commit d7cc0c3730
2 changed files with 18 additions and 3 deletions

View File

@ -11,7 +11,23 @@
module.exports = class Robot
constructor: (opts) ->
@name = opts.name
@connections = initConnections(opts.connection or opts.connections)
@devices = initDevices(opts.device or opts.devices)
@work = opts.work or -> (console.log "No work yet")
initConnections = (connections) ->
console.log "Initialing connections..."
initDevices = (devices) ->
console.log "Initialing devices..."
start: ->
startConnections()
startDevices()
(@work)
startConnections = ->
console.log "Starting connections..."
startDevices = ->
console.log "Starting devices..."

View File

@ -29,8 +29,7 @@ describe "basic tests", ->
# hard equal
data[0].should.be.equal obj
# Now on to a `real` test
it "cylon should create a robot", ->
cylon.should.have.keys 'robot'
robot = cylon.robot(name: 'caprica')
robot.name.should.be.eql 'caprica'
robot = cylon.robot(name: 'caprica six')
robot.name.should.be.eql 'caprica six'