     new models.Dotstorm({
       slug: "test"
     }).save (err) ->
-      expect(err).to.be null
+      expect(err).to.be(null)
       models.Dotstorm.findOne {slug: "test"}, (err, doc) ->
-        expect(err).to.be null
+        expect(err).to.be(null)
         expect(doc.slug).to.eql "test"
         done()
 
   it "creates an idea", (done) ->
     models.Dotstorm.findOne {slug: "test"}, (err, dotstorm) =>
+      expect(err).to.be(null)
+      expect(dotstorm).to.not.be(null)
       @dotstorm = dotstorm
       idea = new models.Idea({
         dotstorm_id: dotstorm._id

    models.Idea.findOne {dotstorm_id: @dotstorm._id}, (err, idea) =>
      expect(fs.existsSync idea.getDrawingPath("small")).to.be true
      idea.remove (err) =>
        expect(err).to.be null
        expect(fs.existsSync idea.getDrawingPath("small")).to.be false
        done()

        background: "#ffffdd"
      })
      idea.save (err) ->
        expect(err).to.be(null)
        dotstorm.groups.push new models.IdeaGroup(ideas: [idea._id])
        dotstorm.save (err) ->
          expect(err).to.be(null)
          models.Idea.findOne {}, (err, idea) ->
            expect(err).to.be(null)
            expect(idea).to.not.be(null)
            expect(idea.description).to.be "open to creative possibility"
            done()

  it "creates a drawing", (done) ->
    models.Idea.findOne {dotstorm_id: @dotstorm._id}, (err, idea) =>
      expect(err).to.be(null)
      idea.drawing = [["pencil", 0, 0, 64, 64]]
      idea.background = "#ffffff"
      idea.save (err) ->
        expect(err).to.be(null)
        expect(idea.drawingURLs.small).to.be "/uploads/dotstorm/idea/#{idea._id}/drawing/small#{idea.imageVersion}.png"
        expect(fs.existsSync idea.getDrawingPath("small")).to.be true
        done()

  it "returns light ideas", (done) ->
    models.Idea.findOneLight {dotstorm_id: @dotstorm._id}, (err, idea) =>
      expect(err).to.be(null)
      expect(idea.drawing).to.be undefined
      done()
 
  it "populates ideas in dotstorm", (done) ->
    models.Dotstorm.withLightIdeas {}, (err, dotstorm) ->
      expect(err).to.be(null)
      idea = dotstorm.groups[0].ideas[0]
      expect(idea.description).to.be "open to creative possibility"
      expect(idea.drawing).to.be undefined
