   @Store.find 1, (err, store) =>
     source = '<div><span data-foreach-product="store.products" data-bind="product.name"></span></div>'
     context = Batman(store: store)
-    helpers.render source, context, (node) =>
-      equal node.children().get(0).innerHTML, 'Product One'
-      equal node.children().get(1).innerHTML, 'Product Two'
-      equal node.children().get(2).innerHTML, 'Product Three'
+    helpers.render source, context, (node, view) =>
+      equal node.children().get(0)?.innerHTML, 'Product One'
+      equal node.children().get(1)?.innerHTML, 'Product Two'
+      equal node.children().get(2)?.innerHTML, 'Product Three'
 
       addedProduct = new @Product(name: 'Product Four', store_id: store.id)
       addedProduct.save (err, savedProduct) ->


QUnit.module "Batman.Model hasMany Associations"
  setup: ->
    namespace = this

    class @Store extends Batman.Model
      @encode 'id', 'name'
      @hasMany 'products', namespace: namespace


          product_id:3
        }]

    namespace.ProductVariant = class @ProductVariant extends Batman.Model
      @encode 'price'
      @belongsTo 'product', namespace: namespace

