     for state in validStates then do (state) ->
       it "should return all jobs of state #{state}", (done) ->
         ideally   = errify done
-        bullModel = new BullModel client
         data      = {name: "testjob"}
-
-        await bullModel.createJobInQueue queuename, data, ideally defer job
-        queue = bullModel.queues[queuename]
-
-        if state is "active"
-          await (queue.moveJob "wait", "active").asCallback ideally defer()
-        else if state is "delayed"
-          await (job.moveToDelayed Date.now() + 1000 * 10).asCallback ideally defer()
-        else unless state is "wait"
-          await (job._moveToSet state).asCallback ideally defer()
+        await fakeJob queuename, data, state, ideally defer {queue, job}
 
         await instance.idsAndCountByState queuename, state, ideally defer {ids, count}
         expect(count).to.equal 1

      qCleaner(queue).asCallback done


describe "RedisModel", ->
  queuename = "test"


  describe "##allKeys", ->
    it "should return all keys from all queues by default", (done) ->
      ideally   = errify done
      data      = {name: "testjob"}

      await fakeJob queuename, data, null, ideally defer {queue, job}
      await fakeJob "test2",   data, null, ideally defer queueAndJob2

      await instance.allKeys null, ideally defer keys
      expect(keys.length).to.equal 2

      qCleaner queue
        .then -> qCleaner queueAndJob2.queue
        .asCallback done

    it "should return all keys from a specific queue", (done) ->
      ideally   = errify done
      data      = {name: "testjob"}

      await fakeJob queuename, data, null, ideally defer {queue, job}

      await instance.allKeys queuename, ideally defer keys
      expect(keys.length).to.equal 1
