 
 describe "Model.apply", ->
   it "Applies given sync stream of functions to the Model", ->
-    b = lib.Model(1)
+    b = Model(1)
     values = collect(b)
     b.apply(Bacon.fromArray([twice, twice, twice]))
     expect(values).to.deep.equal([1, 2, 4, 8])
   it "Applies given async stream of functions to the Model", (done) ->
-    b = lib.Model(1)
+    b = Model(1)
     b.onValue (val) ->
       if val == 2 then done()
     b.apply Bacon.fromBinder (sink) ->

    values = collect(stuff)
    root.set({first:"f", last:"l"})
    expect(values).to.deep.equal([
      {}, 
      {first: "f"},
      {first: "f", last: "l"}])
  it "works when pushing within bacon dispatch", ->
    model = lib.Model {field1: "init"}
    valueLens = model.lens("field1")
    lib.once(1).onValue ->
      valueLens.set("value1")
      expect(valueLens.get()).to.equal("value1")
    expect(valueLens.get()).to.equal("value1")
  it "works when creating lens and pushing within bacon dispatch", ->
    model = lib.Model {field1: "init"}
    model.lens("field1")
    lib.once(1).onValue ->
      valueLens = model.lens("field1")
      valueLens.set("value1")
      expect(valueLens.get()).to.equal("value1")
    expect(model.lens("field1").get()).to.equal("value1")
  it "gets undefined when model structure has been destroyed", ->
    model = lib.Model {users: [{name: "Dan"}]}
    nameLens = model.lens('users.0.name')
    expect(nameLens.get()).to.equal("Dan")
    model.set({users: []})


describe "Model.combine", ->
  it "creates a new model using a template", ->
    cylinders = Model(12)
    doors = Model(2)
    car = Model.combine {
      price: "expensive",
      engine: { type: "gas", cylinders},
      doors
